2021-11-11 06:31 PM
Hi, all.
I hope anyone who can help me ~
I now use STM32F401 & CubeMx to driver color sensor, the color sensor's timing requirements like this:I use master/slave Time to do this:
master Tim1' CH1 to seed PWM(cycle is 500ns, high 200ns, low 300ns), and Tim1 also use for DMA to get data from Dout port(DMA cycle is 500ns too). And use slave Tim3 to control Tim1 to send 12 pulses at sample time. every 12 pulses finished, stop tim1&tim3, wait t2(4us)time, then start again.
According to the above logic, I got this wave:
From this picture, I unable to get 12 pulses stably(sometimes 12 times, sometimes 14 times and sometimes 10times).
Thanks for everyone again.
2021-11-11 07:44 PM
You can use a timer in gated slave mode being driven by a master timer to generate the CK signal. If you set up a slave SPI and use that as the clock and use Dout as MOSI, you can clock in the Dout data using DMA.
2021-11-15 08:13 PM
hi,
Thanks for your reply, I solved it by using register to do master/slave time(not use HAL).