General SPI Question: using SPI.begin();

Normally libraries should control their own CS pins (and most do) and the clock speed should not be an issue, but to be sure, call the begin() function of the slowest device last.

A “bigger” problem is when the SPI modes or bit order are different. Arduino has a transaction scheme that alows for switching between these modes but Particle does not, so many libraries rely on the modes to be set correctly once for all times but if one begin() sets other modes than another device requires, you’d have to call that respective begin() again, with possibly unknown sideffects, depending on the other actions performed in begin().

There was a proposal of @peekay123 for adding SPI transactions a while back, but we haven’t heard anything back from Particle about that since.

2 Likes