LPC54016 SPI with DMA Question

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

LPC54016 SPI with DMA Question

1,076件の閲覧回数
mdbeaster
Contributor I

Hello all. I’m struggling with an issue related to using an SPI Flexcomm via DMA on my LPC54016 project. My application requires me to send large amounts of data without any pauses on an SPI port (~4k bytes). I can get into more detail about the purpose of this if needed but in the interest of brevity I’ll leave that aside for the moment. I have this working perfectly up to 1024 byte, but with larger buffers this was causing a hard fault.

 

I traced this back to the #define DMA_MAX_TRANSFER_COUNT 0x400U (which is decimal 1024) within fsl_dma.h. Is there any way to extend the DMA max transfer size? I changed this #define to a higher value (0x800U) and the code compiles and doesn’t cause a fault when debugging, however the transfer contains a lot less bytes than it should.

 

Thanks in advance for any help.

ラベル(1)
0 件の賞賛
返信
4 返答(返信)

1,052件の閲覧回数
Harry_Zhang
NXP Employee
NXP Employee

Hi @mdbeaster 

This is a hardware limit, and while increasing the macro value may allow the code to compile, it won’t increase the actual hardware capability for the transfer size, which is why your SPI transfer results in incomplete data transmission when attempting to send more than 1024 bytes at once.

You can divide your 4k data into 4 transmissions, each transmitting 1k.

BR

Hang

0 件の賞賛
返信

1,038件の閲覧回数
mdbeaster
Contributor I

Unfortunately I cannot send 1024 bytes, refill the buffer, and then send the next 1024 bytes because it inserts a ~50us delay between the transfers, which screws up my data. Since I posted this question, I found a similar thread from a few years ago. I revived that thread as well hoping for a little more clarity on how exactly to splice the spi_dma examples and the dma_linked_transfer examples together.

 

https://community.nxp.com/t5/LPC-Microcontrollers/LPC546xx-DMA-from-Flexcomm-SPI-port-larger-than-10...

 

0 件の賞賛
返信

998件の閲覧回数
Harry_Zhang
NXP Employee
NXP Employee

Hi @mdbeaster 

Based on your requirements, I have just sent you a demo of SPI with DMA in email.

Hope this will help you.

BR

Hang

0 件の賞賛
返信

985件の閲覧回数
mdbeaster
Contributor I

Hello Hang, thanks for the response. How do I open the attached .patch file? I'm not sure how to access what you sent me. 

0 件の賞賛
返信