This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C1294NCPDT: Get address frame from 9 bit UART

Part Number: TM4C1294NCPDT

Hi Folks,

I develop RS485 communication between some of the CPUs mentioned in the thread header. I wanted to use 9 bit mode of the UART due to the HW support of address detection and the subsequent data flow.

My question is, that I saw an option to set address mask which allow users to set multiple addresses which the device listen to, but how can I get the captured address? How can I discover which of my addresses where addressed by the sender?

Regard,

Norbert

  • Hi Nobert,
    When there is an address match you will get an interrupt. If you have a single address then the matched address will be the one you store in the UART9BITADDR. If you have a range of addresses then you will setup the UART9BITAMASK to filter the valid addresses to receive. You can use the UARTCharGet to read what the address is put out by the sender.
  • Hi Charles,

    somewhere I has been read that the caller can not read the address byte , and I also experienced during my development. So it was the initial thought of this question.

    My application sends the address byte using the appropriate TivaWare library function, than sends subsequent data:

    	uint32_t intState = MAP_UARTIntStatus(MODBUS_UART, true);
    	MAP_UARTIntClear(MODBUS_UART, intState);
    	if (intState & UART_INT_9BIT) {
    		_receivedPDU.Reset();
    	}
    
    	while (MAP_UARTCharsAvail(MODBUS_UART)) {
    	if (_function == Unknown) {
    		_function = MAP_UARTCharGet(MODBUS_UART);
    	}
    	else {
    		_stream[_size] = MAP_UARTCharGet(MODBUS_UART);
    		_size += _size < (sizeof(_stream) - 1) ? 1 : 0;
    	}
    	}
    
    	if ((intState & UART_INT_RT) && (_receivedPDU.Function() != PDU::Unknown)) {
    		xSemaphoreGiveFromISR(_receiveSemaphore, NULL);
    	}
    
    

    The above is my UART interrupt routine: as you can see, there is some initialization work, when I get 9BIT interrupt, than I try to fetch data. Every time, when I put a breakpoint into the read cycle, I don't see the device address .

    Regards,

    Norbert