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.

PROCESSOR-SDK-AM335X: UART Interrupt example

Part Number: PROCESSOR-SDK-AM335X
Other Parts Discussed in Thread: MSP430FR5994

Hello all,

I found an example in PDK of UART Interrupt, But it was written like a polling method. UART is working in polling only.

I tried to do with Callback function and i have done settings accordingly, but its not working.

why is it so?

Anil. 

  • Hi Anil,

    Which example are you referring to?

    Thanks,

    Max

  • Hello Max,

    C:\ti\pdk_am335x_1_0_17\packages\ti\drv\uart\example 

    I have taken an example from the above link. Just the difference i have seen is 

            count=UART_read(uart_handle,buffPointer,1000);
    
            count=UART_readPolling(uart_handle,buffPointer,1000);

    this 2 functions is the change otherwise there is no other change.

    But as per my knowledge there is a option that, we can make ReadCallback function also. but its not working like that, Why?

    /* UART parameters structure polled mode*/
    const UART_Params user_params = {
        UART_MODE_BLOCKING,     /* readMode */
        UART_MODE_BLOCKING,     /* writeMode */
        SemaphoreP_WAIT_FOREVER,/* readTimeout */
        SemaphoreP_WAIT_FOREVER,/* writeTimeout */
        NULL,                  /* readCallback */
        NULL,                 /* writeCallback */
        UART_RETURN_NEWLINE,  /* readReturnMode */
        UART_DATA_TEXT,       /* readDataMode */
        UART_DATA_TEXT,       /* writeDataMode */
        UART_ECHO_ON,         /* readEcho */
        115200,               /* baudRate */
        UART_LEN_8,           /* dataLength */
        UART_STOP_ONE,        /* stopBits */
        UART_PAR_NONE         /* parityType */
    };

    Instead of read Callback NULL function, we can go with real function like Interrupt based.

    Anil.

  • Hello Max,

    Even you can check my example that, I am unable to add GPIO_init function. I am getting, why? Because even I added a GPIO.h header also its giving a problem to me.

    Can you tell me, how to add a GPIO tauggle code in this bare metal example?

    Bare_Metal_Ex.zip

    An in this above example i am unable to add GPIO tauggle example.

    I am not getting, why this is that much complex to learn?

  • Hi Anil,

    For starting with UART and GPIO simultaneously, I suggest starting with the baremetal template app.

    It can be found in: <Processor SDK RTOS folder>\demos\rtos_template_app\am335x\evmAM335x\A8\template_app\baremetal

    Thanks,

    Max

  • Hello max,

    If you check my post properly, I already attached the same example which you are suggesting me right now.

    With the same I tried to attach a GPIO_init(); function but its showing me an error.

    So that only I posted here.

    and As I worked on MSP430FR5994, there Interrupt means - No need to call UART read function always to read UART. So that I am asking what is the meaning of Interrupt, inspite that I have to call that function always.

    You can see in the image that once i added this GPIO_init(); function i am getting an error.

    Please suggest some working example's to me.

    Thanks,

    Anil

  • Hi Anil,

    You'll need to include a GPIO board definition file in your project.

    These files for EVMs can be found in the pdk in the GPIO driver examples.

    Thanks,

    Max

  • Yes Max,

    As you said, I added the library, but I checked that, GPIO_board.h library is already been added there.

    But still I added and compiled it, again i am getting the same error.

    Do I need to add it in Properties -> Build -> GNU compiler -> Directories ?

    Because there also its already added.

    What else we need to do?

    Anil.

  • Hi Anil,

    I'm specifically referring to a file such as "GPIO_bbbAM335x_board.c"

    This is the board definition file for the Beaglebone Black.

    Thanks,

    Max

  • Waw Max,

    This is really working for me, GPIO LED1 is toggling perfectly.

    Really thanks for your support.

    Now I am searching for Another GPIO to toggle, I will try.

    Anil.