8 years, 6 months 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:

Silicon Labs' EFM32™ Leopard Gecko ARM® Cortex®-M3 based 32-bit microcontrollers (MCUs) provide flash memory configurations up to 256 kB, 32 kB of RAM and CPU speeds up to 48 MHz. …

1 Answer

8 years, 6 months 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

Accepted Answer

Thank you for your reply! I'm looking forward for the fix :-)

posted by Bas Stottelaar 21 Oct 2015

Hi Steven, can you give an idea of when to expect a fix? Or any workaround in the meantime?

posted by Bas Stottelaar 03 Nov 2015

Bas,

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 Steven Cooreman 03 Nov 2015