Setup DMA for SPI to 1 Byte transfer

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Setup DMA for SPI to 1 Byte transfer

798 Views
jheni
Contributor I

Hey guys,

I'm Using a Kinetics K64 MCU. We are using a filesystem which is connected via SPI. There's a huge traffic going on in our filesystem therefore I'd like to use a DMA to transfer the data to the SPI periferal.

However our filesystem can only handle 1 Byte transfer. The default SPI DMA Transfer mode is 2 Byte at a time.

Is it possible to change this?

I found this manual: https://www.nxp.com/docs/en/reference-manual/KSDK20APIRM.pdf 

Chap 15.1 explains the DSPI controller. However i could not find an option to set the byte transfer rate.

Could you give me a hint please?

Tags (3)
0 Kudos
2 Replies

662 Views
mjbcswitzerland
Specialist V

Hi Julian

If you know that you have a high data rate for the file system it is logical to use the SDHC interface in the K64 rather than the DSPI interface.

If you are restricted in HW design and must use the DSPI (SD card in SPI mode), single byte transfers are possible in DMA mode using source and destination size of 1 byte in DMA_DCR (0x00120000).

Generally a fie system works with 512 byte sectors and so most transfers will use 512 byte read/write bursts - a single byte DMA transfer is generally of no use since it will not be faster than a single DSP register write (with the setup overhead it will be slower). Also, file system access at the low level (single-medium) must be a blocking call (not allow other users to try to access the same medium before the initial access has completed). Since DMA transfer and a SW loop transfer will not have any timing difference (the SPI rate defines the speed - unless when the SW loop is interrupted by processor interrupts) there is generally no significant speed advantage using DMA.

Regards

Mark


Complete Kinetis solutions for faster/more efficient professional needs, training and support: http://www.utasker.com/kinetis.html
i.MX RT project compatibility: http://www.utasker.com/iMX.html

Kinetis K64:
- http://www.utasker.com/kinetis/FRDM-K64F.html
- http://www.utasker.com/kinetis/TWR-K64F120M.html
- http://www.utasker.com/kinetis/TEENSY_3.5.html
- http://www.utasker.com/kinetis/Hexiwear-K64F.html

uTasker: supporting >1'000 registered Kinetis users get products faster and cheaper to market

Request Free emergency remote desk-top consulting at http://www.utasker.com/services.html

Open Source version at https://github.com/uTasker/uTasker-Kinetis

https://community.nxp.com/thread/512558
https://community.nxp.com/thread/352862
https://community.nxp.com/thread/498809

0 Kudos

662 Views
Sabina_Bruce
NXP Employee
NXP Employee

Hello Julian,

Could you please provide the version of the SDK you are working with. Also are you basing on an example from the SDK? If so, could you please tell me the name of the example.

Best Regards,

Sabina

0 Kudos