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.

TM4C123G 9 bit Uart



Hola,

Estoy utilizando el TM4C123g y me gustaría saber como puedo usar la uart1 (PC4 (Rx) i PC5 (TX)) para poder enviar y recibir 9 bits.Primero intente hacerlo con el bit de paritat, el problema fué que con el logic analyzer veía que podía enviar 9 bits pero en recepción solo leía 8 bits (con el logic analyzer ves que llegan 9 bits pero si imprimes por pantalla lo que hay realmente en la uart solo lees 8 bits) . Entonces, encontré el fichero spma032.pdf pero no es viable, ya que, TivaWare_C_Series-2.1.0.12573 no incorpora el fichero NB_uart.c. Que pasos debo seguir para poder enviar y recibir 9 bits por la uart1?

Tengo interconectada la transmisión y recepción de la uart1, cual debería ser la configuracion de UART9BitAddrSet? El 9 bit se configuraría con el UART9BitEnable (1 al 9 bit) o UART9BitDisable (0 al 9 bit)?

Muchas gracias

Esta es mi configuración: Quiero enviar un 0x110.

ROM_SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
                   SYSCTL_XTAL_16MHZ);

SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);

SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1);

GPIOPinTypeUART(GPIO_PORTC_BASE, GPIO_PIN_4 | GPIO_PIN_5);

GPIOPinConfigure(GPIO_PC4_U1RX);

GPIOPinConfigure(GPIO_PC5_U1TX);

NB_UARTConfigSetExpClk(UART1_BASE, SysCtlClockGet(), 115200,(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_ZERO));

NB_UARTEnable(UART1_BASE);

UARTFIFODisable (UART1_BASE);

UART9BitEnable(UART1_BASE)

UART9BitAddrSet(UART1_BASE, 0x01, 0xFF);

UART9BitEnable(UART1_BASE);

UARTIntEnable(UART1_BASE, UART_INT_TX | UART_INT_RX | UART_INT_RT | UART_INT_9BIT);

UART9BitAddrSend(0x10);

//interrupción

void
UARTIntHandler(void)
{
    uint32_t ui32Status;

    //
    // Get the interrrupt status.
    //
    ui32Status = ROM_UARTIntStatus(UART1_BASE, true);

    //
    // Clear the asserted interrupts.
    //
    ROM_UARTIntClear(UART1_BASE, ui32Status);

    //
    // Loop while there are characters in the receive FIFO.
    //
    while(ROM_UARTCharsAvail(UART1_BASE))
    {
        //
        // Read the next character from the UART and write it back to the UART.
        //
        ROM_UARTCharPutNonBlocking(UART1_BASE,
                                   ROM_UARTCharGetNonBlocking(UART1_BASE));
    }
}

  • Aleix,

    Esto es um forum Ingles. Voy te dar tu respuesta en español pero no soy muy fluente, será español con portugues. Intenta hablar en englis en el futuro. Es la mejor forma de obteres suport.

    En la datasheet tienes tudo bien explicado sobre las configuraciones. En el "Tivaware Peripheral Driver Library user guide" tienes todo sobre como usar las funciones.
    UART9BitEnable te permite los 9 bits. El unico parametro é solo UARTx_BASE.
    UART9BitDisable desativa el modo de 9 bits.

    In English:
    This is an English forum. I'm going to answer (also) in Spanish but I'm not very fluent, it's basically a mix of Spanish with Portuguese. Try to write in English in the future. It's the best way to get support

    In the datasheet you can find the configurations well explained. In the "Tivaware Peripheral Driver Library user guide" there's everything about how to use the functions.
    UART9BitEnable allows to use the 9 bit mode. The only parameter is the UARTx_BASE.
    UART9BitDisable simply deactivates the 9 bit mode.
  • Ok sorry, I am going to write in English. I wanto to know if my configuration is ok or this is someting wrong, which is the configuration of the UART9BitAddrSet I have to use for the uart1 and if I will be able to recover 9 bit with ROM_UARTCharGetNonBlocking(UART1_BASE) and how I how I can configure this 9 bit to change it by 0 or 1.

    Thans for your feedback
  • Good, caring job Luis - thanks.

    Poster must realize - and accept - that school-children throughout Europe and Asia (especially these days) receive in-depth English instruction.   Is that fair - surely No!    Yet - its reality - and conformance here leads to (far) higher paying jobs and greatly aids (especially tech) usage, growth & understanding!

    We native English speakers enjoy a big (and admittedly - unearned) advantage - best to accept - then adapt & improve...

  • Hi Aleix,

    I haven't really used 9bit mode so I can't give you much help :(
    I think your best bet is consulting the datasheet, it seems to describe there exactly what to do. Maybe you could also consult the Tivaware guide for the functions related to the 9bit mode