Hi Andy,
I Looked at Spi_Demo. There were 20 bytes for transfer, ok. The function itself is a synchron function, used within a task will be ok. But, did the hardware generate 20 interrupts which were handled by the ReadWrite function, which ends up in a high processor burden, or is DMA used for this job to free the processor?
As the SPI interface is a very fast interface, generating an interrupt on each transferred byte isn’t that good idea (for my opinion).
My application uses SPI (master on Colibri side) to get 630 byte frames from another system, total byte count at the end of the whole transfer is several mega-bytes. The other system using a queueing system to decouple the two systems time domains, but as the working memory is limited, the response time of the Colibri can’t get too long.
Currently I use a module based on a single kernel Atmel processor running at 500Mhz, which does the job, but this module is discontinued as the company which produces this module is gone.
Now I hope that the Colibri i.MX7 (choosen for its low power consumption) will do the job.
With best regards
Gerhard
Dear @Gerhard
I checked the source code of our library’s Spi_ReadWrite()
function for the iMX7. The actual implementation is done in an SPI driver, so unfortunately each call creates some constant overhead.
Once in a driver, the transfer is done using polling mode. This is the fastest way to read and write small to medium amounts of data, as setting up the DMA also would require quite some overhead. The drawback of the polling method is, that the CPU is busy during the whole transfer.
For example at 20Mbps, your transfer of 630 bytes will take less than 300µs.
There are no interrupts generated during the transfer.
You can slightly optimize the performance by using packed mode, where 4 bytes are stored in a common DWORD.
If the performance would not be sufficient, probably the most significant overhead is to enter and exit the driver. The only way out of this would be to move the whole source code from the driver into the user space.
Please get back to me, if you are facing performance problems. I will help to analyze the environment and search for the easiest solution.
Regards, Andy
Hi Andy,
thanks for this fast repay. I will check out what I have here and will post the results, but … first I have to Setup on module … but this is another Story (not working as described …).
With best regards
Gerhard