2005-04-14 04:10 AM
2005-04-11 08:57 PM
Hello,
I wrote an application using timer, UART and GPIO on the STR710 eval board. The application support X-Modem protocol to download program files. The UART receives the incomming data via interrupt handler '' UART_RxHalfFull | UART_TimeOutNotEmpty ''. In the timer interrupt handler I toggle LED P2_9 with the command GPIO_BitWrite(GPIO2, 9, !GPIO_BitRead(GPIO2, 9)); At runtime I have the following behaviour: The LED9 toggles When I start the file download the download stops after a few seconds. The serial communication lose characters. I debuged my system and found out, that the reason is the reading of IO-Port in interrupt handler routine. When I choose GPIO_BitWrite(GPIO2, 9, !GPIO_BitRead(GPIO2, 9)); to read/write the Port P2.9 the UART lose chars. When I replace the command with GPIO2->PD = oldGpio2Value; if( oldGpio2Value==0) oldGpio2Value = 1<else oldGpio2Value = 0; the program works. I test this behaviour with IO Port P1.X, P2.9, UART0 and UART1. It is allways the same. Is someone there who can tell me the conjunction betwen UART, timer interrupt and GPIO. It seems that reading of GPIO in interrupt handler blocks the UART receiving. PS: When I use the command GPIO_BitWrite(GPIO2, 9, !GPIO_BitRead(GPIO2, 9)); in foreground it works without errors. I initialize Port P2 with GPIO_Config(GPIO2, (0x00001< :-?2005-04-12 09:55 PM
Hello,
what do you mean with ''Timeout value of your application''? ''Do you have the Overrun Error flag set to 1 when you loose characters. '' The overrun flag isn't set. ''Could you use the following code to toggel the GPIO pin GPIO2->PD ^= 1<Using 'GPIO2->PD ^= 1<''Do you use timer interrupts in your application.'' Yes I do. I use the timer compare interrupt. I toggle the LED inside the interrupt handler of this timer. (See last mail. )2005-04-12 10:36 PM
Hello,
I made some further tests and I have some news. To read data from UART and write data into UART I use a queue. When I access the queue's data I store the old interrupt flags, disable the interrupt, prozess the queue and after that I set the old interrput status back. u16 ReadByteFromBuffer(TypeDrvBuffer* buffer , u8 * data, u16 size ) { u16 retVal = 0; u16 oldEic = EIC->ICR; EIC->ICR = 0; //comment out and it works while( retVal < size ) { if( buffer->write == buffer->read )break; if( ++buffer->read== buffer->end ) { buffer->read = buffer->buff; } *(data++) = *buffer->read; retVal++; } EIC->ICR = oldEic; //comment out and it works return retVal; } When I disable the commands 'EIC->ICR = 0;' and 'EIC->ICR = oldEic;' the application works in all cases: GPIO_BitWrite(GPIO2, 9, !GPIO_BitRead(GPIO2, 9)); ->works GPIO2->PD ^= 1<works And I didn't lose chars. There is an other function ''WriteByteToBuffer'' wich disable and enable the EIC->ICR too. The function ''WriteByteToBuffer'' is called from UART reveive interrupt handler. So there must be a conjunction between EIC->ICR enable flags and GPIO-Access ( When the GPIO-Access will be done in timer interrupt) Regards2005-04-14 02:40 AM
Hello,
I set the UART receive timeout to maximum avlue 0xFF. I disable the IRQ in my queue because these list are used as data interface between interrupt handlers and foreground process. When foreground process reads/writes data it is not allowed to access the list from interrupt sometimes. But the question is why do the processor 'fails' when I disable the interrupt in this way?