Re: Reading SPI accelerometers
Posted: Tue Mar 30, 2021 9:03 pm
Yes, this is why I asked you about the used core.misterbo wrote: Tue Mar 30, 2021 3:11 pm Thanks! I eliminated the lines for beginTransaction and endTransaction, and I'm getting slightly better results (12.5kHz) but I didn't get your first point; are you suggesting to use something likeinstead ofCode: Select all
dest=SPI.transfer(zeros, count)
?Code: Select all
for (uint8_t ii = 0; ii < count; ii++) { dest[ii] = SPI.transfer(0); }
In Libmaple (aka Roger's) core there is an SPI.transfer function which transfers block-wise the data to and from the slave device, see: https://github.com/rogerclarkmelbourne/ ... SPI.h#L285, which accepts data arrays for read and write data separately,
There is a variant of the transfer function to input one byte and read an array.
You have to check whether such a function is available in STM core as well, because this would really speed up your app.