Good morning TI experts!
I'm here today because I have some problems (unpredictable, I think) while I'm testing the code I wrote in debug mode.
Let me explain the situation better: I'm writing a keyboard¬epad application and I use FT812 controller for my display.
At some point during the Keyboard() routine I've noticed that the processor stops working correctly.
So I tried to put some break points in the function in order to find out where uP crashes and I can note 3 different behaviours:
- the program jumps to __mpyi_f5hw
- the program jumps to __TI_ISR_TRAP
- the program jumps to 0x0004 ( in the disassembly window I see 3FFF JMP (0x0004)
- the program triggers the WatchDog and restart
I'm sure the problem is inside this routine but which is the best way to find out its root?
Below there are my assumption.
- The routine calls memset function to clear the buffer before the start-up operation
/*clear line*/
for(tval=0; tval<MAX_lines; tval++) {
watchdog();
memset(&buffer.notepad[tval], '\0', sizeof(buffer.notepad[tval]));
}
- I have a function to write text:
void cmd_TEXT (unsigned int x, unsigned int y, unsigned int font, unsigned int opts, const char *t) {
unsigned int lung=0;
lung=strlen(t);
write_COMMAND32(CMD_TEXT);
write_COMMAND16(x);
write_COMMAND16(y);
write_COMMAND16(font);
write_COMMAND16(opts);
write_text(t, lung);
}
void write_text(const char *string, unsigned int longn) {
const char dummy_byte=0x00;
do {
write_COMMAND8(*stringa);
*string++;
}
while(*string!=0);
if(longn>0) {
do {
write_COMMAND8(dummy_byte);
longn++;
}
while ((longn%4)!=0); //--> to load the correct value of the character on RAM_CMD the Offset must be a multiple of 4
}
if(longn==0) {
write_COMMAND8(dummy_byte);
write_COMMAND8(dummy_byte);
write_COMMAND8(dummy_byte);
}
}
Any advice and help would be really appreciated.
Thanks for the attention,
Best Regards,
Maria Angela