Jump to content

SPI bit order on Tiva?

Recommended Posts

Tracking down the reason why my SHARP Memory LCD library does not work on Tiva and C3200 LaunchPads, I noticed that Energia's SPI.setBitOrder is not implemented for these platforms. Digging a bit deeper (i.e. TivaWare and datasheet) I can't see a register to control SPI bit order.


Two questions:

- Did I miss something or does the SSI peripheral not support LSB bit order?

- If not, ARM has an RBIT instruction that would be helpful in a workaround. Any way to invoke this with GCC on a variable without resorting to inline assembly?

Link to post
Share on other sites

Nope, same for Tiva.


Energia did not recognize the ARM or CMSIS intrinsics for RBIT and REV, but this works:

asm("rbit %0, %1" : "=r" (rxtxData) : "r" (rxtxData));    // reverse order of 32 bits
asm("rev %0, %1" : "=r" (rxtxData) : "r" (rxtxData));    // reverse order of bytes to get original bits into lowest byte

Will try with CC3200 next and then post a patch to the SPI libraries that emulates bit order.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...