Help finding the right MCU
I’m currently in the process of developing a wireless gaming mouse, I have the 3D modeling complete but I’m stuck looking for a usable MCU for a Pixart 3395 Optical Sensor. I have a NDA with Pixart
If anyone could help I’d really appreciate it.
13 Replies
Is the topic still alive, @techielew? If so, what has been your progress so far? I would go with some full-fat microcontroller for sure. My favourites are the usual suspects–RP2040 by Raspberry Pi and STM32F7x. I am pretty sure you would need a lot of memory and raw power. If interested, get back and we can discuss your project here.
Thanks for getting back, Petr. The sensor outputs via 4-wire SPI so I'm navigating working with serial interfaces for the first time.
But why a full fat MCU?
Because you need to process image data–not a simple task and almost always quite memory demanding. When you need to process 100 frames per second, for instance, you need to keep previous frames in memory to detect movement. When speaking of the SPI interface. You need a DMA unit inside the MCU to transfer the data into the memory buffers. It means–forget AVR and almost all 8-bit microcontrollers. You must handle the USB bus simultaneously because you do not need lagging. It all led me to "full-fat" microcontrollers. By the term full-fat, I mean at least 72 MHz, ARM-CortexM4F or better.
Yes, that's where my SPI issues are coming in. DMA is a new concept for me and I'm having trouble understanding how to send one sample at a time over SPI at my specified rate.
I get my hardware (STM32F401, https://www.st.com/en/microcontrollers-microprocessors/stm32f401.html) can flag when the buffer is half transferred or fully transferred, which is when to change pointers so the currently prepared half of the buffer is sent to DMA. But regarding the SPI transfer itself, how does the DMA 'know' how to send one sample at a time to the SPI peripheral at my specified rate (48khz)? Do I need another stream with its own flags within an ISR triggered by a hardware timer?
Yes, you need another stream clocking your data rate. Do you work with the Library examples?
If there is no such example, you can inspire yourself with I2S peripheral examples because there is a highly accurate timing used all the time.
Thanks @Petr Dvořák, I do but do you have an example libraries you can suggest?
Examples are a part of the HAL library package.
Sorry I meant i2s peripheral examples
OK, your MCU probably does not have I2S. You can try this document https://www.st.com/resource/en/application_note/an3126-audio-and-waveform-generation-using-the-dac-in-stm32-products-stmicroelectronics.pdf or https://www.st.com/resource/en/application_note/an3997-audio-playback-and-recording-using-the-stm32f4discovery-stmicroelectronics.pdf or simply go through the app notes https://www.st.com/en/microcontrollers-microprocessors/stm32f401/documentation.html
let me know, we can discuss
optical sensor need to be connected via GPIO? I2C?
what all you need on the MCU?