Hi, new to embedded. I am communicating to various peripherals via SPI with the LPC1758. The first device I had working required a 32 bit word. I got this working by sending 2x16 bit words no problem.
I then moved on to the next device which required a 24bit word, which meant that 8-bit SPI transfer was better suited. I then decided to change the previous device implementation to send 4x8bit words instead.
I decided to leave the SPCR->BitEnable (SPCR bit 2) enabled and set SPCR->BITS (SPCR 11:8) to 1000 (8 bits per transfer) and could not get the communication working.
After trying everything I disabled SPCR->BitEnable (SPCR bit 2), which set the transfer to default (8 bit transfer) and suddenly sending works fine with no other changes other than removing SPCR->BitEnable (SPCR bit 2) and SPCR->BITS (SPCR 11:8) from the code.
Is anyone able to tell me why this may be? Didn't post any code as I am unsure if that will help.
kind regards,
Nick
Hi Nicholas Lawrenson,
Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
It seems so weird, definitely, the SPI is able to support the 8-bit format after setting BitEnable bit with BITS=0x1000.
In the LPCOpen library, it provides the periph_spi demo and please refer to it for details.
https://www.nxp.com/support/developer-resources/software-development-tools/lpc-developer-resources-/...
Have a great day,
TIC
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------