2006-06-27 10:36 PM
2006-05-18 11:07 PM
Hi All,
I am using the STR730FZ2T6 device with UARTs running at 500kbaud (over RS485) and using 8-bit data plus wakeup mode to address one of a set of receiving devices, followed by 9-bit data. I am trying to use the UART receive timeout so that I can leave the UART alone until the incoming data message is complete and stored in the receive FIFO. First interrupt received performs the following: if(wUART_ReceiveData == (0x100 | MyAddress)) { UART3->CR = (UART3->CR & 0xFFF8) | UART_Mode_9D; UART3->IER &= ~UART_Flag_RxBufFull; UART3->IER |= (UART_IT_TimeOutIdle | UART_IT_TimeOutNotEmpty); } next interrupt is: if((wUART_Status & UART_Flag_TimeOutNotEmpty) != 0) { while((UART3->SR & UART_Flag_RxBufFull) != 0) { wUART_ReceiveData = UART3->RxBUFR; } UART3->CR = (UART3->CR & 0xFFF8) | UART_Mode_8D_W; UART3->IER &= ~(UART_IT_TimeOutIdle | UART_IT_TimeOutNotEmpty); UART3->IER |= UART_Flag_RxBufFull; } This works but the time between the two interrupts (which should be determined by the value I load into the TimeOut register, UART3->TOR) is always the same (~290uS), regardless of what I write into TOR. Also it says on the data sheet that writing to the TOR should cause the countdown timer to reload and therefore hold-off the interrupt, this is not happening! Has anyone had any success with the TimeOut feature? It would seem that my program cannot write to the TOR register! have a missed soething that need to be done to ''open the access'' to this TOR register? grateful for any help or suggestions PhilipJ :p cadac electronics2006-06-27 10:36 PM
for anyone who is interested in using this feature, I found out what the problem was. There is a mistake in the C library file 73x_map.h
In the structure defining the UART registers it should be: typedef struct { vu16 BR; /*BaudRate register*/ u16 EMPTY1; vu16 TxBUFR; /*TxBuffer Register*/ u16 EMPTY2; vuc16 RxBUFR; /*RxBuffer Register*/ u16 EMPTY3; vu16 CR; /*Control Register*/ u16 EMPTY4; vu16 IER; /*IntEnable Register*/ u16 EMPTY5; vuc16 SR; /*Status Register*/ u16 EMPTY6; u16 EMPTY7; u16 EMPTY8; vu16 TOR; /*Timeout Register*/ u16 EMPTY9; vu16 TxRSTR; /*TxReset register*/ u16 EMPTY10; vu16 RxRSTR; /*RxReset register*/ u16 EMPTY11; } UART_TypeDef; Note the two extra EMPTY's just before the TOR register!!! Hope this saves someone the days of trouble I had trying to get things to work properly!! PhilipJ