This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

RTOS problem in Keil

Hi,

I am using Keil to edit the "DataLog" example application provided in STSW-STLKT01_V2.5.0. I want to use the MotionDI library to get orientation and linear acceleration of my device (STEVAL-STLKT01V1) in real time. For that purpose, I want to insert the MotionDI_update(&data_out, &data_in) function in the DataLog application code. The DataLog application code uses 2 threads to get and print the data from accelerometer and gyroscope. I add the  MotionDI_update(&data_out, &data_in)  in the WriteData_Thread. However, my code hangs after I get the orientation and acceleration for the first time. How to get rid of this issue?

I tried increasing stack size but no success. I want to continuously get data in real time. My code is attached as well.

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
int main(void)
{
HAL_Init();
/* Configure the System clock to 80 MHz */
SystemClock_Config();
MX_GPIO_Init();
MX_DMA_Init();
MX_CRC_Init();
MX_RTC_Init();
// initialize MotionDI library
MotionDI_Initialize(&freq);
/* Optional: Get version */
//MotionDI_GetLibVersion(lib_version);
/* Optional: Modify knobs settings & set the knobs */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
static void GetData_Thread(void const *argument)
{
(void) argument;
T_SensorsData *mptr;
sensorPool_id = osPoolCreate(osPool(sensorPool));
dataQueue_id = osMessageCreate(osMessageQ(dataqueue), NULL);
readDataSem_id = osSemaphoreCreate(osSemaphore(readDataSem), 1);
osSemaphoreWait(readDataSem_id, osWaitForever);
/* Initialize and Enable the available sensors */
Sensor_IO_SPI_CS_Init_All();
MX_X_CUBE_MEMS1_Init();
/* COnfigure LSM6DSM Double Tap interrupt*/
LSM6DSM_Sensor_IO_ITConfig();
if(LoggingInterface == USB_Datalog)
{
dataTimerStart();
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
static void WriteData_Thread(void const *argument)
{
(void) argument;
osEvent evt;
T_SensorsData *rptr;
int size;
char data_s[256];
for (;;)
{
char entry[6];
size=sprintf(entry, "for\n");
osPoolFree(sensorPool_id, rptr); // free memory allocated for message
CDC_Fill_Buffer(( uint8_t * )entry, size);
evt = osMessageGet(dataQueue_id, osWaitForever); // wait for message
if (evt.status == osEventMessage)
{
char entry[6];
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

0