Using DMA to transfer a Struct variable - Forums Re: Using DMA to transfer a Struct variable  I think the GCC compiler paded with extra bytes inside structures.  

You can verify this checking the address of the first and the second element of the structure.

I can't remember if you have to use the attribute "align" or "pack". you can find it in the GCC help manual.




Wed, 08 Feb 2012 22:13:12 -0600
Re: Using DMA to transfer a Struct variable A struct in C can be seen as a sequence of bytes (uint8). When you handle it just like that and use the sizeof(struct MyStructure) macro to calculate the number of bytes to transfer nothing can go wrong.

The SPI interface may go wrong when you send data faster than they are clocked out of the interface. I do not know how you are checking the FIFO in your DMA-process. I doubt that the supplied interrupt routines wotk together with DMA.

I would suggest to set the TX-Buffer-size to a sufficient value and send the structure as a whole (array of bytes) to the SPI and let it be handled by the internal interrupts.


Wed, 08 Feb 2012 07:05:14 -0600