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.

IntEnable(); TM4C123G

Hello

I'm trying to use the instruction: IntEnable(INT_UART3); but when I build the project it makes a mistake.

That seems right when the argument is: IntEnable(UART3_BASE);  but I'm not sure if that is correct. 

Regards

  • Hello Gustavo,

    IntEnable(INT_UART3) is the correct method. Did you add the define TARGET_IS_TM4C123_RB1 during compilation?

    Also is the inc/hw_ints.h included in the list of include files?

    Regards
    Amit
  • Oh thank you for your help ! I had not included that file.
    There are some options for example:

    INT_UART3_TM4C123
    INT_UART3
    INT_UART3_TM4C129

    What does it mean?

    Regards
    Gustavo
  • Hello Gustavo,

    It is INT_UART3. The use of the define TARGET_IS_TM4C123_RB1 automatically maps the INT_UART3_TM4C123 to INT_UART3. Similarly the use of TARGET_IS_TM4C129_RA2 maps INT_UART3_TM4C129 to INT_UART3

    Regards
    Amit
  • Hello Amit,

    What happen if I don't enable the UART FIFO ? If I don't set UARTFIFOenable() and UARTFIFOdesable() functions ?

    Regards
    Gustavo
  • Hello Gustavo,

    If the UART FIFO is not enabled then on the TX direction there can be only one character be sent while CPU needs to hold off the next TX character. On the RX when the last character is in the holding buffer and if the CPU does not read it before the next character is received, then it may be over written.

    Regards
    Amit
  • Hi,

    UARTEnable() function silently enables the FIFO, so if someone needs to play with only one character at the time, then after enabling the UART, mandatory use UARTFIFODisable().

    Amit, most/many eight bit micros did not have FIFO, still the communication can be done...

    Regards,

    Petrei

  • Hello Petrei,

    Yes, I agree with you. I was only trying to highlight the fact that not using the FIFO will have a different behavior than using the FIFO.

    Regards
    Amit
  • Thanks Amit.

    And another question jeje I'm trying to send an array of 30 bytes from other system (with Arduino) to my system (with Tiva) by UART but I only receive the first 16 bytes, and I do not know if it is an issue of the TIVA micro. That happens when I enable the buffer but when I disable it I only get the first byte.

    Regards
    Gustavo
  • Hello Gustavo,

    How are you reading the UART Buffer? I have got this issue on the forum multiple times and in my test with Boot Loaders and P2P between two TM4C devices I have never seen this issue.

    Regards
    Amit
  • I send the command 0x61 to the Arduino and it replies with the array of 27 bytes. The variable TotDato31A has a value of 27 which is the total bytes expected. But I only get the first 16. I set the function UARTCharGetNonBlocking(); in order to prevent an infinite loop if there are loss bytes. 
    However I tried to set the UARTCharGet() function but it happens the same. 
    Thanks

    case 0x61:

    UARTCharPut(UART1_BASE,0x61);
    UARTCharPut(UART0_BASE,0x0A);
    UARTCharPut(UART0_BASE,0x0D);
    SysCtlDelay(2000000);
    cont = 0;
    while(cont < TotDato31A){

    Z = UARTCharGetNonBlocking(UART1_BASE);
    if (Z != -1){
    UARTCharPut(UART0_BASE, Z);
    cont++;
    }
    else{
    cont++;
    }
    }

    break;

    while(1)

    {

    //Adquisicion de la imagen
    SendCommandToSoC(0x61);
    SysCtlDelay(1000000);

    }

  • Look closely at your read loop. Why do you expect it to wait for characters to arrive?


    It actually bothers me more that you read more than one character when the FIFO is enabled. that suggests you are waiting long enough for all or most of the reply to be sent before reading. That will mean most of it never makes it into the already filled FIFO.

    You probably should separate your read and write/echo steps. As written issues in one may become issues in the other.

    Robert
  • Hello Gustavo,

    In the loop mentioned, why are you incrementing the cont variable if there is no character available? Secondly why "SysCtlDelay(2000000);" before reading any character? Did you check the Status bits from the UART to see if there is a FIFO overrun?

    Regards
    Amit