serj86 wrote on Saturday, August 01, 2015:
Hi !
I use FreeRTOS 7.6.0 generated by CubeMX 4.9.0 with STM32F303 MCU (ARM CM4F) + IAR 6.50 Compiler.
I send sensor L3DG20_Data struct to queue in timer callback function and try to read it in L3GD20_Thread.
After receive from queue, in gyro_raw_data struct L3GD20_AXIS_Z variable is always 0. iar debugger watch
Another two variables in struct transmitted correctly.
What can be wrong there?
Code:
typedef struct {
i16_t L3GD20_AXIS_X;
i16_t L3GD20_AXIS_Y;
i16_t L3GD20_AXIS_Z;
} AxesRaw_t;osMessageQId GyroRawDataQueueHandle;
osTimerId GyroTimerHandle;…
void CallbackGyroTimer(void const * argument);
static void L3GD20_Thread(void const * argument);…
osTimerDef(GyroTimer, CallbackGyroTimer);
GyroTimerHandle = osTimerCreate(osTimer(GyroTimer), osTimerPeriodic, NULL);osMessageQDef(GyroRawDataQueue, 16, AxesRaw_t);
GyroRawDataQueueHandle = osMessageCreate(osMessageQ(GyroRawDataQueue), NULL);…
static void L3GD20_Thread(void const * argument) {
AxesRaw_t gyro_raw_data;
for(;{
if( GyroRawDataQueueHandle != 0 ) { xQueueReceive( GyroRawDataQueueHandle, &( gyro_raw_data ), ( portTickType ) 10 ); }
}
}void CallbackGyroTimer(void const * argument) {
AxesRaw_t L3DG20_Data;L3GD20_GetAngRateRaw(&hspi1, &L3DG20_Data);
xQueueSendToBack(GyroRawDataQueueHandle, ( void * ) &L3DG20_Data, ( portTickType ) 0);
}