Author Topic: DMA & SPI  (Read 6640 times)

Offline frank

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
DMA & SPI
« on: July 05, 2013, 01:18:55 PM »
Hi,

Does the current uTasker for Freescale MCF5223x supports the DMA transfers to SPI Master?. If so,

1. how to do buffer transfer (perhaps use DMA?)
    - from USB to the SPI ?.
    - from Ethernet MAC to SPI ?

2. Does the uTasker OS support variable clock speeds on the SPI interface? What is the granularity? What is the min speed?

3. Does that above feature works for uTasker OS on STM32F407 as well ?/

Thanks.



Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3234
    • View Profile
    • uTasker
Re: DMA & SPI
« Reply #1 on: July 05, 2013, 01:41:26 PM »
Hi Frank

The M522xx QSPI doesn't support slave mode of SPI operation and so can not communicate with an SPI master (it can only be an SPI master itself).
Furthermore, the DMA controller can only be triggered by DMA timer or UART peripherals (or software control). This means that it is not very useful to operate the SPI using DMA since the SW would probably have to trigger it and couldn't transfer more that 16 bytes at a time.
That is, it would be possible to perform a DMA transfer from memory to the SPI buffers (up to the buffer depth of 16 if my memory serves me correctly) but the next transfer could not be started until these buffers have been sent (otherwise there would be an overflow) since the SPI doesn't trigger DMA it wouldn't be possible to automate the next block transfer. In addition, the way that the buffers work requires start the number of transfers to be written in the buffers to which would be a further complication (explaining why there is probably no such support for SPI DMA peripheral transfers by the chip).

1. Without DMA the received buffers (from USB or EMAC) could be sent to SPI using a SW loop (similar to buffer transfers in the SPI flash drivers - such as spi_flash_m5223x_atmel.h)
2. The SPI speed can be controlled in the QMR register directly and so can be changed freely by reading the present setting and writing the speed mack back.
3. The STM32F407 can work in SPI slave mode but the driver is different. I haven't used this with DMA but the rest should be equivalent.

Regards

Mark


P.S. I have used the Kinetis SPI with DMA (in slave and master modes). This device is very powerful and flexible (including its many DMA channels) so for any new designs I would certainly prefer this part due to these capabilities.

Offline frank

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
Re: DMA & SPI
« Reply #2 on: July 19, 2013, 08:38:13 PM »
Thanks Mark. Probably Freescale Kinetis would be the best option to do DMA transfer functionalities across the usb/ethernet to SPI master bus.