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.

UART1 problem in DM6437's pspdrivers_1_10_03

 

 

Using UART1 with pspdrivers_1_10_03 driver, I have a problem that my program doesn't go to main function.

 

(1) I changed .tcf file 

         bios.UDEV.create("UART1");

         bios.UDEV.instance("UART1").fxnTableType = "IOM_Fxns";

         bios.UDEV.instance("UART1").initFxn = prog.extern("uart1_dev_init");

         bios.UDEV.instance("UART1").params = prog.extern("uart1DevParams");

         bios.UDEV.instance("UART1").fxnTable = prog.extern("UARTMD_FXNS");

         bios.UDEV.instance("UART1").deviceId = 1; 

(2) I changed GIO_create() and PINMUX.

    /* Power up settings for UART1

     * TIMER1 = 0: VDD3P3VPWDN - bit 9

     */

    sysModuleRegs->VDD3P3V_PWDN &=  (~(0x200u));

    //  Pinmux setting for UART1

    //  TIM1BK = 10 :   PINMUX1 - bit 21:20

    //

    sysModuleRegs->PINMUX1  &=   (0xFFEFFFFFu);

    sysModuleRegs->PINMUX1  |=   (0x00200000u);

 

/* Initialize UART

    * Currently is been used to display messages

    */

    hUart_OUT = GIO_create("/UART1",IOM_OUTPUT,NULL,&chanParams,&gioAttrs);

    hUart_IN  = GIO_create("/UART1",IOM_INPUT,&echoTskStatus,&chanParams,&gioAttrs);

(3) I added EVMDM6437_init() in uart1_dev_init funtion to power on UART1

 

But, it still doesn't go main function. How can I solve this problem?

 

  • Thank you for your prompt reply. But, your reply isn't shown here.

    Anyway, I couldn't solve my problem yet.

    I modified UART0 sample program in following directory,

    \pspdrivers_1_10_03\packages\ti\sdo\pspdrivers\system\dm6437\bios\evmDM6437\uart\,

    to use UART1. I have been using UART1 with pspdrivers_1_10_00 in similar way.

    I found that it doesn't go to main function if I change deviceid from '0' to '1'.

    Please find what the fault is in my program source.

    (1) In .tcf file, I changed uart0 to uart1, and added deviceid.

     

     

             bios.UDEV.create("UART1");

             bios.UDEV.instance("UART1").fxnTableType = "IOM_Fxns";

             bios.UDEV.instance("UART1").initFxn = prog.extern("uart1_dev_init");

             bios.UDEV.instance("UART1").params = prog.extern("uart1DevParams");

             bios.UDEV.instance("UART1").fxnTable = prog.extern("UARTMD_FXNS");

             bios.UDEV.instance("UART1").deviceId = 1; 

     

    (2) My source code

    #include <std.h>

    #include <stdio.h>

    #include <string.h>

    #include <tsk.h>

    #include <gio.h>

    #include <iom.h>

    #include <log.h>

     

    #include <psp_uart.h>

     

    #include <pal_sys.h>

     

    #ifdef PSP_UART_EDMA_SUPPORT

    #include <edma3_drv.h>

    #endif

     

    #define UART_DEBUG(a)    LOG_printf(&trace,a)

     

    #define SIZEOF_UART_STRING_START (128u)

    #define SIZEOF_UART_STRING_STOP (32u)

    #define SIZEOF_UART_STRING (32u)

     

    #ifdef PSP_UART_EDMA_SUPPORT

    extern EDMA3_DRV_Handle hEdma;

    extern EDMA3_DRV_Result edma3init();

    #endif

    /*

     * External References

     */

     

    /* UART handle for input channel */

    extern GIO_Handle hUart_IN;

     

    /* UART handle for output channel */

    extern GIO_Handle hUart_OUT;

     

    extern LOG_Obj    trace;

     

    #ifdef PSP_UART_ASYNC_MODE_SUPPORT

    /* GIO application call back for TX and RX */

    GIO_AppCallback     txAppCb;

    GIO_AppCallback     rxAppCb;

     

    /* local function prototypes */

    static void uart_TxAppCallback(Ptr arg,Int status, Ptr bufp, size_t size);

    static void uart_RxAppCallback(Ptr arg,Int status, Ptr bufp, size_t size);

    #endif

     

    /*

     * Global References

     */

     

    /* UART1 device params. To be filled in uart0_dev_init function which

      is called before driver creation */

    PSP_uartDevParams   uart1DevParams;

     

    /* Global function prototypes */

    void uart1_dev_init(void);

     

    /*

     * Local References

     */

     

    /* Local function prototypes */

    static void genericUartTest();

     

    /*

     * Starting message printing string

     * Note: Buffer alignement is required only when working in DMA Mode.

     */

    #pragma DATA_ALIGN(uartTestStringStart, 128);

    static Int8 uartTestStringStart[SIZEOF_UART_STRING_START];

     

     

    /* Tx memory buffer */

    #pragma DATA_ALIGN(Uart_TxBuffer, 128);

    static Int8  Uart_TxBuffer[1024];

     

     

    /*

     * UART1 init function called when creating the driver.

     */

    void uart1_dev_init()

    {

    #ifdef PSP_UART_EDMA_SUPPORT

        EDMA3_DRV_Result    edmaResult      = 0;

    #endif

        /* Power On UART */

     

        /* UART driver - Initializing device params */

        uart1DevParams.inputFreq       = PSP_UART_MODULE_CLOCK;

        uart1DevParams.fifoEnable      = TRUE;

        uart1DevParams.opMode          = PSP_OPMODE_INTERRUPT;

     

    #ifdef PSP_UART_EDMA_SUPPORT

        uart1DevParams.opMode          = PSP_OPMODE_DMAINTERRUPT;

    #endif

        uart1DevParams.loopbackEnabled = FALSE;

     

        uart1DevParams.baudRate    = PSP_UART_BAUD_RATE_115_2K;

        uart1DevParams.stopBits    = PSP_UART_NUM_STOP_BITS_1;

        uart1DevParams.charLen     = PSP_UART_CHARLEN_8;

        uart1DevParams.parity      = PSP_UART_PARITY_NONE;

        uart1DevParams.rxThreshold = PSP_UART_RX_TRIG14;

        uart1DevParams.fc.fcType   = PSP_UART_FC_TYPE_NONE;

        uart1DevParams.fc.fcParam  = PSP_UART_FC_NONE;

     

         // uart1DevParams.hwiNumber = 9;    // I tried to add this as you mentioned , but hwiNumber isn't member of PSP_uartDevParams   

     

         // uart1DevParams.rxThreshold = PSP_UART_RX_TRIG1;    //  I tried to add this as you mentioned , but it isn't helpful.

     

        // EVMDM6437_PSC_changeState( LPSC_UART1, PSC_ENABLE ); // I tried to add this as you mentioned , but it isn't helpful

     

    #ifdef PSP_UART_EDMA_SUPPORT

        if (NULL == hEdma)

        {

            edmaResult = edma3init();

            if (edmaResult != EDMA3_DRV_SOK)

            {

                /* Report EDMA Error */

                UART_DEBUG("\r\nEDMA3 : edma3init() failed\r\n");

            }

            else

            {

                UART_DEBUG("\r\nEDMA3 : edma3init() passed\r\n");

            }

        }

    #endif

    }

    void echo()

    {

        GIO_Attrs gioAttrs = GIO_ATTRS;

        Int32 echoTskStatus= 0;

        PSP_uartIoParams chanParams;

     

        /*

         * Initialize channel attributes.

         */

        gioAttrs.nPackets = PSP_UART_NUM_IOP;

     

        chanParams.hEdma = NULL;

     

    #ifdef PSP_UART_EDMA_SUPPORT

        chanParams.hEdma = hEdma;

    #endif

     

        /* Power up settings for UART1

         * TIMER1 = 0: VDD3P3VPWDN - bit 9

         */

        sysModuleRegs->VDD3P3V_PWDN &=  (~(0x200u));


        //  Pinmux setting for UART1

        //  TIM1BK = 10 :   PINMUX1 - bit 21:20

        //

        sysModuleRegs->PINMUX1  &=   (0xFFEFFFFFu);

        sysModuleRegs->PINMUX1  |=   (0x00200000u);

     

       /* Initialize UART

        * Currently is been used to display messages

        */

        hUart_OUT = GIO_create("/UART1",IOM_OUTPUT,NULL,&chanParams,&gioAttrs);

        hUart_IN  = GIO_create("/UART1",IOM_INPUT,&echoTskStatus,&chanParams,&gioAttrs);

        if((NULL == hUart_IN)||(NULL == hUart_OUT))

        {

            PSP_DEBUG_PRINT("ERROR: Initialization of UART failed\n");

            return;

        }

     

        if((NULL != hUart_IN)||(NULL != hUart_OUT))

        {

            /* Run UART sample application */

            start_uart_sample();

        }

     

        return;

    }

    ....

     

    void main()

    {

    return;

    }

     

  • Hi sung-je cheon,

    The reason why you are unable to view my post is because I deleted it. I'm sorry, i misinterpretted the PSP version and provided wrong inputs. Regarding the issue what you are observing, I have a question and some tasks for you..

    sung-je cheon said:

    In .tcf file, I changed uart0 to uart1, and added deviceid.

             bios.UDEV.create("UART1");

             bios.UDEV.instance("UART1").fxnTableType = "IOM_Fxns";

             bios.UDEV.instance("UART1").initFxn = prog.extern("uart1_dev_init");

             bios.UDEV.instance("UART1").params = prog.extern("uart1DevParams");

             bios.UDEV.instance("UART1").fxnTable = prog.extern("UARTMD_FXNS");

             bios.UDEV.instance("UART1").deviceId = 1; 

    Have you removed ' bios.UDEV.create("UART0"); ' and other settings corresponding to UART0 completely or they are still in place with the above additional settings?. If both the devices are created, then a problem might occur because "PSP_UART_NUM_INSTANCES" in "psp_uart.h" file is set to 1u. This shoud be made 2u if you are creating more than one instance.

    Secondly, If this is not the case as mentioned above then i would suggest you to perform a small task. Place a breakpoint at uart_mdBindDev() in dda_uartBios.c (Placed in: pspdrivers_1_10_03\packages\ti\sdo\pspdrivers\drivers\uart\src) and then reload the program. As this a static creation of the UART instance, this part of code will run first and then the main() will be called. If you are unable to reach main() then my assumption is that you are facing some problems in the static creation itself. Step in through the uart_mdBindDev() and check as to where exactly the program is halting. 

    Hope this helps.Please let me know the results..

     

    Thanks & regards,

    Raghavendra

  •  

    I traced uart_mdBindDev() in dda_uartBios.c.

    (1) At the first time, it failed to pass if condition in <point 1>, because IOM_UART_NUMPORTS = PSP_UART_NUM_INSTANCES = 1u.

    (2) I changed PSP_UART_NUM_INSTANCES = 2u and recompile driver and traced again

    In this time, it failed to pass if condition in <point 2>, because uartport->inUse is TRUE. (I think that uart_Ports[1] isn't initialized in point 3.)

    I don't know how to fix it.

     

    static Int uart_mdBindDev(Ptr *devp, Int devId, Ptr devParams)

    {

    ...

    static UartPortObj  uart_Ports[IOM_UART_NUMPORTS]= {DDA_PORTOBJ_INIT}; <- point 3

     

        /* The driver must receive a valid device parameters  */

        if( ((IOM_UART_NUMPORTS > devId) && (devParams != NULL))  && (NULL != devp)) <- point 1

        {

            /* Get the device parameters of the specified port */

            uartport = &uart_Ports[devId];

            uartport->instNum = (Uint16)devId;

     

     

            /* Check if the port was already bound to the DSP/BIOS */

            if ( TRUE != uartport->inUse ) <- point 2

            {

     

  • sung-je cheon said:
    static UartPortObj  uart_Ports[IOM_UART_NUMPORTS]= {DDA_PORTOBJ_INIT};

    Yes, It seems to be correct what you say. Can you please change it to:

    static UartPortObj  uart_Ports[IOM_UART_NUMPORTS]= {DDA_PORTOBJ_INIT,DDA_PORTOBJ_INIT};

    and check if this works fine?.. Hope you understand what i am trying to convey. The uart_Ports[1] isn't initialized in point 3. So try initializing it and then proceed. If you still face any issues, then lets see what can be done.

    Please let me know your results..

     

    Thanks & regards,

    Raghavendra

  • I changed what you suggested and it seems to be working.

    Please confirm that it is ok for using UART1 if I change two points in uart driver.

    (1) PSP_UART_NUM_INSTANCES = 2u

    (2) static UartPortObj  uart_Ports[IOM_UART_NUMPORTS]= {DDA_PORTOBJ_INIT,DDA_PORTOBJ_INIT};

     

    And, actually I want to use both UART0 and UART1 together.

    Are there any more changes which I have to do?

     

    I'm going to do as follows.

    (1) In .tcf file

    bios.UDEV.create("UART0");

             bios.UDEV.instance("UART0").fxnTableType = "IOM_Fxns";

             bios.UDEV.instance("UART0").initFxn = prog.extern("uart0_dev_init");

             bios.UDEV.instance("UART0").params = prog.extern("uart0DevParams");

             bios.UDEV.instance("UART0").fxnTable = prog.extern("UARTMD_FXNS");

             bios.UDEV.instance("UART0").deviceId = 0; 

     bios.UDEV.create("UART1");

             bios.UDEV.instance("UART1").fxnTableType = "IOM_Fxns";

             bios.UDEV.instance("UART1").initFxn = prog.extern("uart1_dev_init");

             bios.UDEV.instance("UART1").params = prog.extern("uart1DevParams");

             bios.UDEV.instance("UART1").fxnTable = prog.extern("UARTMD_FXNS");

             bios.UDEV.instance("UART1").deviceId = 1; 

    (2) In code

    ...

      hUart0_OUT = GIO_create("/UART0",IOM_OUTPUT,NULL,&chanParams,&gioAttrs);

       hUart0_IN  = GIO_create("/UART0",IOM_INPUT,&echoTskStatus,&chanParams,&gioAttrs);

    ...

    hUart1_OUT = GIO_create("/UART1",IOM_OUTPUT,NULL,&chanParams,&gioAttrs);

         hUart1_IN  = GIO_create("/UART1",IOM_INPUT,&echoTskStatus,&chanParams,&gioAttrs);

    ...

    If I need to consider something more, please let me know.

    p.s thank you for your great help.

     

  • Hi sung-je cheon,

    Thats good news!.

    And coming to your questions, to use both UART0 and UART1 together i thing these changes are enough to proceed. It should work fine. And also make sure that you have implenemted the following:

        1. uart0_dev_init and uart1_dev_init appropriately for uart0 and uart1. 

        2. uart0DevParams and uart1DevParams configured/initialized appropriately.

    Seems to be like you have done these, but just wanted to inform you that these are important as a part of implementation in the application.

    Another advise from my side is that, I request you to get(test) UART1 alone working first and then UART0 alone. This confirms both UART0 and UART1 are working fine, then you can proceed further implementing both UART's together.

    Please let me know the results..

    Thanks & regards,

     Raghavendra

  • I checked that both UART0 and UART1 are working well in my system.

    Until now, I don't have any trouble with this.

     

    Thanks for your help.

     

     

  • Hi Sung-je cheon,

     

    An IR (SDOCM00081089) has been raised to keep in track of this issue. This will be fixed in the future release.

     

    Thanks & regards,

    Raghavendra

  • Hi Sung-je cheon,

    My name is Jhaeri Reyes. Can you send me your example project where you successfully got both UARTs working fine, please?

    I already did the same steps as you mentioned, but I haven't obtained both UARTs working together. When UART1 is enabled, UART0 reception is disabled, but UART0 transmission is working well.

    Best Regards,

    Jhaeri