Hey,

Im trying to stabilize my quadcopter with motion flow, so i bought an ADNS3080 to do so.
im working with an stm32f3 (its programmed in c). I already made the spi connection, but i cant find the methods to get the data, any help would be wonderfull

thanks!

You need to be a member of diydrones to add comments!

Join diydrones

Replies are closed for this discussion.

Replies

  • Hi, I have been successful in making this work on Arduino UNO.  You would probably need to convert to cortex, though.  Can you show me a small snippet of stm32 code?

    • hi, this is my main, where i think is the problem... i have an example that uses the gyroscope of the stm32 as an spi and i tried copied that code and modified it. Where i think is my problem is when i send the ADNS3080_DELTA_X that the stm32 doesnt know how to interpretate it.

      int main(void)
      {
      int8_t delta_x;
      clock_setup();
      gpio_setup();
      usart_setup();
      spi_setup();

      gpio_clear(GPIOE, GPIO3);
      spi_read8(SPI2);
      gpio_set(GPIOE, GPIO3);

      while (1) {


      gpio_clear(GPIOE, GPIO3);
      spi_send8(SPI2, ADNS3080_DELTA_X);
      spi_read8(SPI2);
      spi_send8(SPI2, 0);
      delta_x=spi_read8(SPI2);
      my_usart_print_int(USART2, (delta_x));
      gpio_set(GPIOE, GPIO3);

      int i;
      for (i = 0; i < 80000; i++)
      __asm__("nop");
      }

      return 0;
      }

      Thanks

      • i figured out one of the errors... so my new code is this one... now the error i think it is it doesnt initialize, because it give me 0's

        int main(void)
        {
        int8_t delta_x;
        clock_setup();
        gpio_setup();
        usart_setup();
        spi_setup();

        //config
        gpio_clear(GPIOE, GPIO3);
        spi_send8(SPI2, ADNS3080_CONFIGURATION_BITS);
        spi_read8(SPI2);
        spi_send8(SPI2, ADNS3080_PIXELS_X | ADNS3080_PIXELS_Y);
        spi_read8(SPI2);
        gpio_set(GPIOE, GPIO3);

        while (1) {

        gpio_clear(GPIOE, GPIO3);
        spi_send8(SPI2, ADNS3080_DELTA_X);
        delta_x=spi_read8(SPI2);
        my_usart_print_int(USART2, (delta_x));
        gpio_set(GPIOE, GPIO3);

        int i;

        for (i = 0; i < 80000; i++)
        __asm__("nop");
        }

        return 0;
        }

        • Hi, try looking at this code.  You will have to tweek it a bit since I am not familiar with stm32 code.

          ___spi_app.txt

          https://storage.ning.com/topology/rest/1.0/file/get/3702787411?profile=original
          • Thanks a lot!
            It is alive :D, now i need to know how to give me the delta x and delta y but that is another problem, it is now initialize!

This reply was deleted.

Activity