Trying to Write two SDCards at same time using SPI. MK20DX256VLL10 Hello, this is my first post here, please tell me if im doing something wrong. Also english is not my main language, sorry if i say something wrong. I'm trying to write two SDCards at same time using SPI. Why at the same time? Because i need to do as fast as possible. At the time im writing this, im able to copy 48Mb of hex numbers in 07:10 minutes, using 10Mhz in SPI clock. I use the functions generated by Processor Expert: "SM*_ReceiveBlock(SM*_DeviceData, &Buffer, qnt*). After gathering some logs with my logic, i noticed that even if i send: SM2_ReceiveBlock(SM2_DeviceData, &Suporte, 1); SM2_SendBlock(SM2_DeviceData, StartBlock, 1); SM3_ReceiveBlock(SM3_DeviceData, &Suporte, 1); SM3_SendBlock(SM3_DeviceData, StartBlock, 1); The SPI sends first the SM2 and them SM3. If its the SPI machine who sends the blocks and handle the receiving, i should be able to make these two at same time, no? Kinetis M Series MCUs Re: Trying to Write two SDCards at same time using SPI. MK20DX256VLL10 Hello @Pedro_Henrique,
In order to understand better you application, Is SM2_SendBlock blocking? If the answer is yes, then to allow transfers to occur simultaneously, they must be handled through interrupts; otherwise, the core will execute the transfers sequentially, one after the other. Additionally, DMA can be added for higher speed.
BR Habib Re: Trying to Write two SDCards at same time using SPI. MK20DX256VLL10 Sorry about the late reply. Yes, both SM2_SendBlock and SM3_SendBlock are blocking. Handling trought interrupts you say any interrupt? Like, calling them from a external interrupt? About DMA, i was looking for this. I think i will try to add DMA, but first i would need executing the transfers simultaneously. Re: Trying to Write two SDCards at same time using SPI. MK20DX256VLL10 Hello @Pedro_Henrique, You need to configure the SPI to use interrupts instead of blocking writes. This approach allows both data transfers to occur simultaneously. You can achieve this using Processor Expert, and this community post might be helpful as a reference. Additionally, you can review this guide, which demonstrates a typical use case for SPI interrupts. Although the example is not specifically for the K20, the implementation steps are essentially the same.
BR Habib
查看全文