Hello all, i am currently working on a development board with the ST10 and a NS16c552 duart with 16Byte FIFO. I am trying to use the duart to connect to a bluetooth module. I am having some difficulties and with the DUART ISR, which causes some unpredictable behaviour, and i was wondering if anyone has some experience with this duart ? I am writing the ISR in c for the tasking compiler, and i am not quite sure how to check the different registers of the DUART without erasing possible other interrupt sources. Well i think i better post the ISR so far, and maybe someone can help me out a bit TIA _interrupt (CC12INT) void isr_exi4 (void) //ISR f�r BT { u16 data,isr,lsr,msr; //Reading out the possible Interrupt causes isr = DUART->FCR_ISR; switch(isr) { case LSR_INT: { lsr = DUART->LineStatusReg; printf("LSR ERROR. Code: %x",lsr); } break; case RDT_INT: case RDR_INT: { printf("R"); do { //if buffer was empty and DISPATCHER_ENABLED then //generate a new Event. #ifdef DISPATCHER_ENABLED if( rb_empty(&rx) ) { //printf("*"); disp_put_event( UART0_RCV_EV, 0 ); } #endif // DISPATCHER_ENABLED if( rb_full(&rx) ) { // ERROR: receive buffer overflow printf("Duart Receive ringbuffer underflow!"); } else { //Get the data from the buffer data = DUART->buffer; // there is enough space in buffer // then store the received data in buffer rb_back(&rx,data); rb_push_back(&rx); printf("[%x]",data); } if ( (UART0_RX_BUFFER_SIZE-rb_read_pending(&rx)) > UART0_RX_BUFFER_HIGH_WATERMARK ) { // over watermark: we are low on buffer -> signal to other party // to stop sending printf("RX High[%i]\n",rb_read_pending(&rx)); DUART->ModemControlReg = STOP_SENDING; } }while ((DUART->LineStatusReg & 0x01) == 0x01); printf("\n"); } break; case THRE_INT: { if( rb_empty(&tx) ) { //printf("TX Buffer empty\n"); UART0_TX_Process = FALSE; } //we have some more data to transmit else { // ongoing transmission UART0_TX_Process = TRUE; // start transmition of next byte data = rb_front(&tx); rb_pop_front(&tx); DUART->buffer = data; //printf("{%x}",data); UART0_TX_Process = FALSE; } } break; case MSR_INT: { msr = DUART->ModemStatusReg; printf("MSR ERROR. Code: %x",msr); } break; //if ISR = 0xC1 default: { //printf("Unknown ISR. Code: %x",isr); } } }
DUART ISR
Started by ●April 8, 2004
Reply by ●April 9, 20042004-04-09
If you're having problems with a bluetooth device, it might that you're not monitoring flow control coming from the device; it looks like you're only generating flow control to the device. --Anthony "Vasilios Dimos" <el98650@central.ntua.gr> wrote in message news:c53j3s$1fql$1@ulysses.noc.ntua.gr...> Hello all, > i am currently working on a development board with the ST10 and a NS16c552 > duart with 16Byte FIFO. > I am trying to use the duart to connect to a bluetooth module. I am having > some difficulties and with the DUART ISR, > which causes some unpredictable behaviour, and i was wondering if anyonehas> some experience with this duart ? > I am writing the ISR in c for the tasking compiler, and i am not quitesure> how to check the different registers of the DUART > without erasing possible other interrupt sources. Well i think i betterpost> the ISR so far, and maybe someone can help me out a bit > TIA > > > _interrupt (CC12INT) void isr_exi4 (void) //ISR f�r BT > { > u16 data,isr,lsr,msr; > > //Reading out the possible Interrupt causes > isr = DUART->FCR_ISR; > > switch(isr) > { > case LSR_INT: > { > lsr = DUART->LineStatusReg; > printf("LSR ERROR. Code: %x",lsr); > } > break; > > case RDT_INT: > case RDR_INT: > { > printf("R"); > do > { > //if buffer was empty and DISPATCHER_ENABLED then > //generate a new Event. > #ifdef DISPATCHER_ENABLED > if( rb_empty(&rx) ) > { > //printf("*"); > disp_put_event( UART0_RCV_EV, 0 ); > } > #endif // DISPATCHER_ENABLED > > if( rb_full(&rx) ) > { > // ERROR: receive buffer overflow > printf("Duart Receive ringbuffer underflow!"); > } > else > { > //Get the data from the buffer > data = DUART->buffer; > // there is enough space in buffer > // then store the received data in buffer > rb_back(&rx,data); > rb_push_back(&rx); > printf("[%x]",data); > } > if ( (UART0_RX_BUFFER_SIZE-rb_read_pending(&rx)) > > UART0_RX_BUFFER_HIGH_WATERMARK ) { > // over watermark: we are low on buffer -> signal to other party > // to stop sending > printf("RX High[%i]\n",rb_read_pending(&rx)); > DUART->ModemControlReg = STOP_SENDING; > } > }while ((DUART->LineStatusReg & 0x01) == 0x01); > printf("\n"); > } > break; > > case THRE_INT: > { > if( rb_empty(&tx) ) > { > //printf("TX Buffer empty\n"); > UART0_TX_Process = FALSE; > } > //we have some more data to transmit > else { > // ongoing transmission > UART0_TX_Process = TRUE; > // start transmition of next byte > data = rb_front(&tx); > rb_pop_front(&tx); > DUART->buffer = data; > //printf("{%x}",data); > UART0_TX_Process = FALSE; > } > } > break; > > case MSR_INT: > { > msr = DUART->ModemStatusReg; > printf("MSR ERROR. Code: %x",msr); > } > break; > //if ISR = 0xC1 > default: > { > //printf("Unknown ISR. Code: %x",isr); > } > } > } > >