Hello together,
i´m trying to combine the TiRTOS with the MPU9150 RTOS example.
- TM4C123G DevelopmentBoard
-CodeComposerVersion V6
-TiRTOS for TIVA-C V2.0.2.36
-TIVAWARE 2.1.0
- Dani Rebollos Touch Display Boosterpack2 and driver http://danirebollo.es/index.php/blog/item/23-lcd-boosterpack-v2
I stripped everything but the dataCollectionTaskFxn(). That means i removed the Tasks and Inits for Write to SD Card and USB.
When i call
WidgetMessageQueueProcess();
the system crashes. I call it inside the dataCollectionTaskFxn(). If i comment it out and use just the drawRectangle and DrawString functions everything is ok.
I have worked through the RTOS Workshop, but i can´t figure out what i´m doing wrong. Probably i lack some particular information from the workshop (there where quite a lot of infos^^)
Finally i wanted to ask, what i have to consider, to solve this. I think this approach is, what a lot of others do.
Cheerio!
Following is my dataCollectionTaskFxn().
It reads the first ACC Data and writes a current averaged value and a smallest and a biggest value to the display.
Void dataCollectionTaskFxn(UArg arg0, UArg arg1) { signed short tmp = 0; static signed short oldNeg = 0, oldPos = 0; char c1, c2; static int aveCntr = 0, ave = 0; /* Use the 1st instance of MPU9150 */ mpu = MPU9150_init(0, Board_I2C_MPU9150, I2C_MPU9150_ADDR); if (mpu == NULL) { System_abort("MPU9150 could not be initialized"); } while (1) { Semaphore_pend(sampleData, BIOS_WAIT_FOREVER); if (!MPU9150_read(mpu)) { GPIO_write(Board_LED0, Board_LED_ON); System_abort("Could not extract data registers from the MPU9150"); } else { c1 = mpu->data[4]; c2 = mpu->data[5]; tmp = 0; tmp |= ((c1<<8) + c2); ave += tmp; if(aveCntr == 7) { ClrScreen(ClrWhite); tmp = ave >> 3; if(tmp < oldNeg) oldNeg = tmp; if(tmp > oldPos) oldPos = tmp; ave = 0; GrContextFontSet(&sContext, &g_sFontCm30b); convertNumberToString(tmp,stringNbr); GrContextForegroundSet(&sContext, ClrRed); GrStringDrawCentered(&sContext, stringNbr, 6,GrContextDpyWidthGet(&sContext) / 2, 160, 0); convertNumberToString(oldNeg,stringNbr); GrContextForegroundSet(&sContext, ClrRed); GrStringDrawCentered(&sContext, stringNbr, 6,GrContextDpyWidthGet(&sContext) / 2, 185, 0); convertNumberToString(oldPos,stringNbr); GrContextForegroundSet(&sContext, ClrRed); GrStringDrawCentered(&sContext, stringNbr, 6,GrContextDpyWidthGet(&sContext) / 2, 210, 0); aveCntr = 0; } else { aveCntr++; } WidgetMessageQueueProcess(); } } }