This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2640R2F: SPI library initialization leads to an exception in BIOS_start()

Part Number: CC2640R2F
Other Parts Discussed in Thread: SYSBIOS

We have a custom board with CC2640R2 MCU and successfully run ProjectZero on it. We use the SDK v1.50.00.58 and CCS 9.3.0.
We successfully use PIN, UART, and I2C drivers and everything works perfectly fine, but we got some strange issues when tried to run the SPI driver: when we add a call of the SPI_init() function to main(), a "ti_sysbios_family_arm_m3_Hwi_excHandler__I()" exception happens after the BIOS_start(), and no RTOS task is executed.

The problem is caused by SPI_init() function. We don't even call SPI_open(). But the SPI_init() itself is executed without any problem. The problem happens when BIOS_start() is running. If we remove SPI_init() from the main(), everything works as expected. I checked the code of SPI_init and don't see anything that can lead to the exception. Do you have any idea why it happens?

  • Are you saying the application crashes immediately after calling BIOS_start(), and that your task functions does not even get to execute? If you put a breakpoint at the beginning of the task function(s), does it halt before crash occurs?

  • Severin, thanks for the quick response!

    The BIOS_start() function is started and I was able to go inside with a debugger. I don't know what is going inside sicnce there is a lot of assembler code, but I'm sure that the task I created doesn't get executed: I put a breakpoint at the very beginning of it and it never halts. When I remove "SPI_init();" line from the main, everything works as expected.

    Thanks,

    Eugene

  • I took a look at the SPI_init() function: it is really similar to the UART_init() or I2C_init() functions, but the last functions don't cause any issue.

    The code of SPI_init() function is pretty short and the function itself is executed well:

    1. It disables interrupts
    2. It sets "isOpen" and "spiPowerConstraint" flags to false
    3. It enables interrupts

    I don't see anything that may cause the exception after the BIOS_start() call.

  • Hi Eugene,

    The only thing that comes to mind is that the SPI defines is not setup properly in your project. There is really no connection between the init function and the TI-RTOS kernel. You say you get into the exception handler, have you tried using the ROV to decode and get information were the exception occurred?

    You should also consider upgrading your SDK, 1.50 is very old and is missing some vital security fixes.

  • Hi M-W,

    I don't know what was wrong, but upgrading the SDK to the latest 3.40 version solved the issue. Thank you for the advice!

    Eugene