-
Notifications
You must be signed in to change notification settings - Fork 65
STM32FreeRTOS breaks I2C #39
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
Look like the problem is with the Here's a simple program that crashes at
By crashing I mean Also I'm getting this warning: |
Solved by uncommenting |
Hi, Note that PIO is not supported here so maybe the config is not correct with pio. |
On the second look, these are the results that I'm getting:
|
Ok, I was able to recreate the problem in the Arduino environment. Simply adding Or even simpler, the same thing happens in the example of |
Ran this test with 4 processors. STM32F407 Discovery (Cortex-M4) — PASS All pass without
|
Fix issue raised in issue comment: stm32duino#39 (comment) when configMEMMANG_HEAP_NB is equal to 1, 2 or 4 Signed-off-by: Frederic Pillon <[email protected]>
Fix issue raised in issue comment: stm32duino#39 (comment) when configMEMMANG_HEAP_NB is equal to 1, 2 or 4 Signed-off-by: Frederic Pillon <[email protected]>
I must add another one - that may just be a problem of PIN interrupts, I suspect. My current project uses IRMP library that depends on PIN interrupts to decode IR signals. I wanted to apply RTOS tasks in favor of Arduino TaskScheduler (working very well, but is only a simple time slicer with no priority control at the end) in the future and included the library STM32FreeRTOS as lib dependency some weeks ago - to remember the idea. Working on other parts of my project I did not test the IRMP decoding - because it just worked as expected before. Two days ago I tested the orchestration of all my routines and IRMP did not work any longer. Happy me, I was able to check different branches of my code back to the past and ensured my hardware was still ok. The problem is - as soon as I include (no header files!) STM32FreeRTOS into the platformio configuration IRMP stops working. This is reproducible at any time. |
Update. I thought that using The problem still remained with port.c: void vPortEnterCritical( void )
{
portDISABLE_INTERRUPTS();
uxCriticalNesting++;
__asm volatile( "dsb" ::: "memory" );
__asm volatile( "isb" );
}
/*-----------------------------------------------------------*/
void vPortExitCritical( void )
{
configASSERT( uxCriticalNesting );
uxCriticalNesting--;
if( uxCriticalNesting == 0 )
{
portENABLE_INTERRUPTS();
}
} Since
So yes, this code hanging up in the #include <Arduino.h>
#include <STM32FreeRTOS.h>
void setup() {
volatile int *a = (int *) malloc(16);
*a = 1;
free((int *)a);
delay(1);
}
void loop() {
} Is things working as expected 🤔 |
Not a super detailed bug report, but just wanted to raise this issue.
Seems like if the FreeRTOS is included in the project (no FreeRTOS code is even in the binary), I2C or something lower-level than it breaks.
In particular, execution gets stuck in the first call to
i2c_master_write()
becauseHAL_GetTick()
doesn’t get updated once inside the function, so:delta = (HAL_GetTick() - tickstart)
is stuck at 0.I'm using platformio with Nucleo-64 G071 board.
Simply removing
stm32duino/STM32duino FreeRTOS@^10.2.1
from library dependencies inplatformio.ini
fixes the problem.The text was updated successfully, but these errors were encountered: