-
Notifications
You must be signed in to change notification settings - Fork 3k
LPC1768 SPI received bytes are shifted on mbed lib r147 #4847
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
There was no change in SPI for v147, neither in drivers (please look at git log to confirm that nothing has changed there) for this target that could cause this. |
I tested LPC1768 SPI with Fujitsu MB85RSxxx FRAM component and the result are not identical between mbed library Rev. 146 and 147. I will find out further.
|
The constructor of the component library is something like:
I temporary added frequency() function call like below and the test program works fine as same as rev 146.
|
@toyowata Can you pinpoint to the changeset that affects this? I cant locate any changes in SPI API, neither HAL for this target? |
@0xc0170 This should be an issue in HAL, not SPI API. I just quick checked to review SPI HAL code of the LPC1768 and found that This is not only for LPC1768 SPI issue, but also other NXP LPC platforms (LPC11U68, LPC1114, LPC4337 and more?), because the LPC1768 code was reused for same SSP/SPI peripheral module. |
The control register of LPC1768 SSP/SPI is below: The SCR bits are configured for SPI serial clock rate. This CR0 register is updated in the As far as I checked, following platform are affected this problem.
I will make fixes and PR for all targets above. |
It also affects TARGET_LPC408X, and there of course both TARGET_LPC4088 and TARGET_LPC4088_DM, so LPC408x should be fixed too. Regards |
Thanks @toyowata for looking at this. I still fail to understand why it is not broken in earlier mbed lib versions? |
Hi @0xc0170
In the Rev.146 SPI code, SPI::format() always set NULL to SPI::_owner which means calling the SPI::format() always calls both spi_format() and spi_frequency() of target HAL. de89be3#diff-3b346da4102b78a8fc25d52adb92b458L46 In the Rev.147 (and current code), SPI::format() calls only spi_format() HAL function, because _owner variable was set by _acquire() call from the constructor when instance is created. https://github.com/ARMmbed/mbed-os/blob/master/drivers/SPI.cpp#L40 That is different behavior of SPI API. Obviously, behavior of the Rev.147 is correct and unvailed latent problem in LPCs SPI HAL implimentation. |
See https://developer.mbed.org/questions/78684/SPI-stopped-working-in-MBED-2-rev-147/
Maybe related to CMSIS5 or did that not get rolled out on mbed 2?
The text was updated successfully, but these errors were encountered: