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.
9 years, 1 month ago.
SPI not working
I tried the SPI Hello World example (https://developer.mbed.org/handbook/SPI), but it does not work. I have modified the example to use SPI1/USART1 (also tried SPI2/USART2, even though PC2 is not available on the STK-3600):
SPI spi(PD0, PD1, PD2);
To verify, I hooked up a scope, but I do not see any clock activity. I then exported the program to Simplicity Studio, but as soon as it hits the code below, I get the error "Unknown error code" and the debug connection is lost.
spi.write(0x8F); // No matter what I send, so not related to 0x8F
When I slowly step through the code (including the assembly instructions of spi.write()), it sometimes does not crash and the code after spi.write() is executed. Tried to change frequency and format, add some wait(), but no luck.
I hooked up a nRF24L01+, but since I don't get any activity at all, I assume that is irrelevant.
Any advice?
Question relating to:
1 Answer
9 years, 1 month ago.
Hi Bas,
We are currently aware of the issue and working on it. It seems something went wrong in one of the code cleanups, and the function that should prevent the EFM from entering a 'too low' sleep mode has a corner case where it is not called in some situations.
Hope to fix it soon!
Steven
Hi Steven, can you give an idea of when to expect a fix? Or any workaround in the meantime?
posted by 03 Nov 2015Bas,
Sadly, the mbed team is too busy with TechCon to make new releases at this time, so it will be mid-November earliest. In the meantime, what you can do is replace the 'mbed' library with 'mbed-src', go to the file 'targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/spi_api.c', and remove the sleep(); call on line 362. That should fix your issue.
A more permanent fix (keeping in mind the power consumption of busy-waiting) is in the works, but like I stated above, will take some more time to propagate into mbed.
posted by 03 Nov 2015