Replies: 17 comments 3 replies
-
@StefJar I'm moving this issue as "question" until we're able to prove the issue actually lies in the driver. |
Beta Was this translation helpful? Give feedback.
-
@erwango I am talking about 2 issues related to spi via DMA and ISRs. Maybe you know someone with a F412 demo board. This person can prove the DMA channel issue. Maybe the other issue is related to that as well. For me it feels, that the spi3 config (polarity, clk rate, etc.) is not proper changed between the DMA transfers/ISR processes. At my full set up the uart3 and spi3 are both using the DMA for their rx/tx. The uart code is still marked experimental(I am using the ASYNC option). So maybe there is some undetected issue as well. |
Beta Was this translation helpful? Give feedback.
-
@StefJar Would you be able to test you set up using differential testing
For reference, I've been able to do basic testing on a nucleo_f411re using DMA=y, ISR=y and DMA+ISR. |
Beta Was this translation helpful? Give feedback.
-
I you check the "nucleo_f411re.overlay" you will see that the dma channel for rx and tx is the same. So pls change them to maybe 3 and 2 and confirm that it generates the stream busy message.
0x28440 -> 0x440 Maybe here lies a mistake from my side |
Beta Was this translation helpful? Give feedback.
-
I've tried the following successfully:
|
Beta Was this translation helpful? Give feedback.
-
0x440 vs 0x28440 = Bit15 and Bit16-17 are different I am understanding the priority level |
Beta Was this translation helpful? Give feedback.
-
Why do you say this "should be always aligned to 32Bit" ? |
Beta Was this translation helpful? Give feedback.
-
Ok cool. My stuff is working with the test DMA settings. So I think my problem is not related to that. Guess we can rule out the DMA channel setup. |
Beta Was this translation helpful? Give feedback.
-
This still not clear to me why you enable both DMA and ISR if you only have one SPI device enabled. This being said, can you have a try using only DMA ? Then only ISR ? |
Beta Was this translation helpful? Give feedback.
-
I done the requested tests:
results: Fail = SPI only reads from ads1292 device but not from lsm6ds3. |
Beta Was this translation helpful? Give feedback.
-
Thanks for these tests! Just to be sure, can you provide the configuration you're using for UART3? This would be surprising there's a conflict since you mention this is working with ads1292, but who knows ? If there is no conflict, it would mean that we're having a specific issue to alternate reads on 2 devices when using DMA, while this is working with IRQ.. |
Beta Was this translation helpful? Give feedback.
-
yep sure
plus
all my tests went against the latest main branch (6e2522d) I will quickly drop the device config here
lsm6ds3
|
Beta Was this translation helpful? Give feedback.
-
@StefJar Why are you using both int1 and int2? Are you putting drdy on int1 and some other event on int2? Can you also give me some hints on how you are testing it on F412 nucleo? I would like to try to replicate it as well without too much wiring... Thanks! |
Beta Was this translation helpful? Give feedback.
-
Sorry, I clicked on "close" by mistake. |
Beta Was this translation helpful? Give feedback.
-
I don't have a nucleo F412 only a pcb(of the headphones my company is doing) where I attach my programmer/debugger. I wrote a driver for the lsm6ds3 and the ads1292. They are on the same spi3 bus. These driver are not really generic. I am using my own dts binding for them. In the lsm6ds3 case you can have 2 signal lines. They are connected at the pcb and so they are connected at the dts. At the firmware only one signal is used. |
Beta Was this translation helpful? Give feedback.
-
I reminded now that I have a sensortile.box board supported by zephyr working well which has already multiple devices on spi1 bus. I can try to replicate the issue on it. So, if my understanding is correct, I would need to enable the dma in the DT (which is a good thing anyway) and make sure that the channel is the same one for tx and rx streams. Is it correct? |
Beta Was this translation helpful? Give feedback.
-
@avisconti yes that should do.
Best would be if your sensortile.box board has at least 2 sensors at the same spiX bus. Ideally both sensors have different bus clks and polarity etc. Just to make sure that the MCU switches the spi_config rightfully. Here I can rule out the spi_config changes as root cause for the DMA problem. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I on my stm32f412 discovered that a SPI3 config related issues.
1st) the rx and tx dma channel must be the same
2nd) the comms to my lsm6ds3 sensor only works when the DMA and INTR config is disabled
my board dts:
the config
As said the interrupt and/or dma option breaks my code. Means that the transfer to lsm6ds3 fails. Also the transfer to ads1292 fails from time to time.
When using different DMA channels the SPI driver complains with:
<err> dma_stm32: dma stream 0 is busy.
Any idea why only same dma channels for rx&tx are working?
Beta Was this translation helpful? Give feedback.
All reactions