Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
6 years, 8 months ago.
SPI stopped working in MBED 2 rev 147
Yesterday, while modifying an LPC1768 project, I updated the MBED library to the latest revision (147).
Immediately the SPI link to an Adafruit FRAM stopped working correctly in that all bytes received were shifted right by one: for example a byte which contained 42h was read as 21h.
I would normally suspect the incorrect SPI mode being used, however the FRAM requires mode 0 and the SPI setup in my code specifies mode 0 and this has worked for a long time with revision 146 but doesn't with revision 147.
Reverting back to revision 146 has resolved the problem.
Has anyone else had this issue or can advise on what might have changed between revisions?
SPI IoFramSpi (p5, p6, p7); //mosi, miso, sclk, DigitalOut IoFramCs (p8); IoFramSpi.frequency(FRAM_FREQ); //FRAM_FREQ = 10MHz IoFramSpi.format(8, 0); //bits, mode
1 Answer
6 years, 8 months ago.
Thank you very much for your report.
This is a bug in the LPC1768 (and other LPC MCUs) SPI HAL implementation and will be tracked here. https://github.com/ARMmbed/mbed-os/issues/4847
Weird, I created an issue for the core team here.
posted by Jan Jongboom 02 Aug 2017Hi,
What's happen if you change function calling order for frequency() and format() APIs?
posted by Toyomasa Watarai 03 Aug 2017I will try changing the order when I get home tonight. Thanks for taking this trouble; it was good to see that someone else could reproduce what I was seeing.
posted by Andrew Boyson 03 Aug 2017Changing the order worked. Thank you for your help.
posted by Andrew Boyson 03 Aug 2017The fix has been merged. https://github.com/ARMmbed/mbed-os/pull/4869
posted by Toyomasa Watarai 19 Aug 2017