Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Loading

I2C interrupts non responding anymore

Posted by bertino on April 22, 2014

Hi,

I'm setting up a FreeRTOS v8.0.0 application on an STM32L1xxB (Cortex M3) based. I have a strange issue when calling I2C functions within my tasks :

whenever I call a function to write some I2C data it will trigger corresponding interrupts only if :

1) it gets called in the task initializazion section (before the inifinite for loop)

AND

2)It gets wrapped in a function itself.

For example, my I2C function is I2CWriteReg(DeviceAddress, RegAddress, numdata, &beffer[0]); Related TX interrupts will be generated only I do the following :

uint32t I2CInitializeRegister(...) { return I2CWriteReg(DeviceAddress, RegAddress, num_data, &beffer[0]); }

and then I call the function from the task inititlization section : static void LedTask( void pvParameters ) { I2CInitializeRegister(...); / if I call I2C_WriteReg(...) here it will not work */

for(;;){ /* if I call I2C_WriteReg(...) here it will not work */ } }

Same thing holds for I2C RX interrupts when I use I2C_ReadReg(...)

I've taken precautions on NVICPriorityGroup = 4 and tested the I2C interrupts with priority 0 (maximum) and then 12 that is between configLIBRARYMAXSYSCALLINTERRUPTPRIORITY (=5) and configLIBRARYLOWESTINTERRUPT_PRIORITY(=15) since in later developments I'm planning to use xSemaphoreGiveFromISR(...) functions within I2C interrupt context to wake up tasks waiting for I2C operations.

Do you have any suggestion on what my problem might be related to ? Best Regards, Adalberto


I2C interrupts non responding anymore

Posted by rtel on April 22, 2014

If I understand your post correctly it would seem rather bizarre, which of course it can't really be, there must be some logical explanation. If I understand you correctly then calling:


ReturnedValue = I2C_WriteReg(Device_Address, Reg_Address, num_data, &beffer[0]);

... does not result in the expected value in the ReturnedValue variable, but calling


uint32_t AnOtherFunction( void )
{
    return I2C_WriteReg(Device_Address, Reg_Address, num_data, &beffer[0]);
}

ReturnedValue = AnOtherFunction();

does result in the expected value in the ReturnedValue variable.

What is the expected value, and why do you say the first case is not working? Can you step through the assembly code in each case to see what the differences are? The value returned from the function should be returned in R0 (the register R0).

Regards.


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner