I've made a 2x16 LCD driver, which have a putc function. Createda BaseSequentialStream for it, to able to use the built in chprintf function.
My code is:
Code: Select all
/* @Pseudo: Set the DB7 */
HWI_vidDOUTWrite(LOC_pstrLcdWorkingStr->strPinConfigStructure->u8DataBit7,
((u8LcdDataByte & LCD_COMPARE_DB7)) >> 7);
/* @Pseudo: Set the DB6 */
HWI_vidDOUTWrite(LOC_pstrLcdWorkingStr->strPinConfigStructure->u8DataBit6,
((u8LcdDataByte & LCD_COMPARE_DB6)) >> 6 );
/* @Pseudo: Set the DB5 */
HWI_vidDOUTWrite(LOC_pstrLcdWorkingStr->strPinConfigStructure->u8DataBit5,
((u8LcdDataByte & LCD_COMPARE_DB5)) >> 5 );
/* @Pseudo: Set the DB4 */
HWI_vidDOUTWrite(LOC_pstrLcdWorkingStr->strPinConfigStructure->u8DataBit4,
((u8LcdDataByte & LCD_COMPARE_DB4)) >> 4 );
/* @Pseudo: Set the DB3 */
HWI_vidDOUTWrite(LOC_pstrLcdWorkingStr->strPinConfigStructure->u8DataBit3,
((u8LcdDataByte & LCD_COMPARE_DB3)) >> 3);
/* @Pseudo: Set the DB2 */
HWI_vidDOUTWrite(LOC_pstrLcdWorkingStr->strPinConfigStructure->u8DataBit2,
((u8LcdDataByte & LCD_COMPARE_DB2)) >> 2 );
/* @Pseudo: Set the DB1 */
HWI_vidDOUTWrite(LOC_pstrLcdWorkingStr->strPinConfigStructure->u8DataBit1,
((u8LcdDataByte & LCD_COMPARE_DB1)) >> 1 );
/* @Pseudo: Set the DB0 */
HWI_vidDOUTWrite(LOC_pstrLcdWorkingStr->strPinConfigStructure->u8DataBit0,
((u8LcdDataByte & LCD_COMPARE_DB0)) >> 0 );
/* @Pseudo: Generate 1 clock to EN */
vidLcdStrobePin(PIN_EN);
the vidLcdStrobePin is a macro which contains a EN = High, chThdSleepMicroseconds(500), then EN = Low.
When the software initializing the tasks chprintf(&LCDStreamData, "TEST") is called, and the charachters are shown on the LCD.
But when I call this function again in a periodic task, the software freeze. and the openocd show the following error:
Code: Select all
Error: ChibiOS registry integrity check failed, double linked list violation
Info : Only showing current execution because of a broken ChibiOS thread registry.
Other infos: If I decrement the chThdSleepMicroseconds values lower then 500 uS the LCD not working, but in the reference document there is a 500 nS minimum EN pulse.
Any idea why this can happen?