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 instance is disabling UART0 reception in DM6437

Other Parts Discussed in Thread: TMS320DM6435

Hello,

I'm succesfully using UART0 in DM6437 using the uart PSP drivers, in interrupt mode, with flow control enabled.
However, when I try to instance UART1 in my code then UART0 stops receiving, the  gio_read() function blocks itself and doesn't detect any more rx interruptions
(never unblocks ),  this doesn't happen when having only UART0.

My configuration in DSPBIOS is:
-------------------------------------------

/* Uart0 Driver*/
bios.UDEV.create("UART0");
bios.UDEV.instance("UART0").fxnTableType = "IOM_Fxns";
bios.UDEV.instance("UART0").initFxn = prog.extern("UART0_INIT");
bios.UDEV.instance("UART0").fxnTable = prog.extern("UARTMD_FXNS");
bios.UDEV.instance("UART0").params = prog.extern("Uart0_DevParams");
bios.UDEV.instance("UART0").deviceId = 0;

/* Uart1 Driver*/
bios.UDEV.create("UART1");
bios.UDEV.instance("UART1").fxnTableType = "IOM_Fxns";
bios.UDEV.instance("UART1").initFxn = prog.extern("UART1_INIT");
bios.UDEV.instance("UART1").fxnTable = prog.extern("UARTMD_FXNS");
bios.UDEV.instance("UART1").params = prog.extern("Uart1_DevParams");
bios.UDEV.instance("UART1").deviceId = 1;

My initialization parameters and functions are:
------------------------------------------------------------

UARTMD_DevParams Uart0_DevParams =
                    {
                        /** Driver operation mode */
                        PSP_OPMODE_INTERRUPT,
                        /** Sync mode enabled */
                        TRUE,
                        /** Default input module clock */
                        PSP_UART_MODULE_CLOCK,
                        /** Edma handle */
                        NULL
                    };
UARTMD_DevParams Uart1_DevParams =
                    {
                        /** Driver operation mode */
                        PSP_OPMODE_INTERRUPT,
                        /** Sync mode enabled */
                        TRUE,
                        /** Default input module clock */
                        PSP_UART_MODULE_CLOCK,
                        /** Edma handle */
                        NULL
                    };

void UART0_INIT()
{
    if(NULL != hEdma) //hEdma defined in edma library
    {
        Uart0_DevParams.hEdma = hEdma;
    }
}
void UART1_INIT()
{
    if(NULL != hEdma) //hEdma defined in edma library
    {
        Uart1_DevParams.hEdma = hEdma;
    }
}

I'm also taking care of PINMUX0, PINMUX1 ,PSC and VDD3P3V_PWDN to enable both UARTs  properly.

What  can be happening ????  IF i comment out the "UART1" instace in the DSPBIOS .tcf file, UART0 receives and transmites sucessfully, however if include that code then UART0 is able to transmit but GPIO driver blocks itself as if it never detected the rx interruptions,

can somebody help me out please??? I have NO IDEA what can be wrong, I already read the UART user manual, datasheet, checked the PSP Uart sample code, and my code is as shown in example  (the inconvinience is that the example code only works for UART0 and not both uarts at the same time )

PLEASE PLEASE HELP !!!

  • Hi Rafael,

     

    Can you please confirm, which version of the PSP you are using?.

    There is a problem in initializing two UART’s while using PSP for DM6437. This query was addressed and solved. Also, an IR has been raised to track this issue.

     

    Please refer to the following post -

    http://e2e.ti.com/support/embedded/f/355/p/100010/351762.aspx#351762

     

    The necessary pinmux and other configuration is also done to get both UART0 and UART1 working. Hopefully, incorporating this might solve the problem.

     

    Thanks & regards,

    Raghavendra

  • Hi Raghavendra,

    I had coincidentally already checked that thread before posting my question,  I went and checked the corrections that were made to the driver in that thread against my driver's code.. but the code is slightly different,  to start, the parameter PSP_UART_NUM_INSTANCES is 2, as it should be.

    But the definition of uart_Ports[] in dda_uartBiosIom.c is

    /* This is the globally declared port object which will be containing
     * all the information for the parameters of the driver                 */
    UartPortObj  uart_Ports[IOM_UART_NUMPORTS];

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

    in fact the define DDA_PORTOBJ_INIT doesn't exist in the driver's code.

    The function uart_mdBindDev() in dda_uartBios.c. is also different:
    /*
     *  ======== uart_mdUnBindDev ========
     *  uart_mdUnBindDev() is called by DEV_init() to unbind and
     * de-initialize the hardware.
     */
    static Int uart_mdUnBindDev(Ptr devp)
    {
        UartPortHandle port = NULL;
        PAL_Result status = IOM_COMPLETED;

        if(devp == NULL)
        {
            status = (IOM_EBADARGS);
        }
        else
        {
            port = (UartPortHandle)devp;
            if (port == NULL)
            {
                status = IOM_EBADARGS;
            }
            else
            {
                /* Checks for the device state */
                if ((port->UartState != UART_CREATED) && (port->UartState
                                                                    != UART_CLOSED))
                {
                    status =  (IOM_EBADMODE);
                }
                else
                {

                    if(PSP_OPMODE_POLLED    !=  port->uartParams.opMode)
                    {
                         /* Unregister interrupt handler from OS */
                        _DDA_uartUnregisterIntrHandler(
                                                    port->uartPortNumber,
                                                    port->dda_PortObj.ddcIntrNum);
                    }
                        /* Close DDC */
                    _DDC_uartClose(&port->dda_PortObj.device.ddcObj,NULL);
                    /* De-Init DDC */
                    _DDC_uartDeInit (&port->dda_PortObj.device.ddcObj,NULL);
                    /* Delete DDC Instance */
                    _DDC_uartDelInst(&port->dda_PortObj.device.ddcObj,NULL);
                    port->UartState = UART_DELETED;
                }
            }/* if port is NULL */
        }/* if devp is NULL */
        return (status);
    }

    As I run the compiled driver, there's no way for me to debug the code since I include the UART driver as a library in my proyect (uart_bios_drv.lib)

    Oh, and the PSP version I have is 1.00.02.00 , I figured it out since I pull the driver from:
    C:\dvsdk_1_01_00_15\psp_1_00_02_00\pspdrivers\lib\DM6437\Debug\uart_bios_drv.lib

     

    ¿Does all this tell you something ?

  • Hi Rafael,

     

    The code is different because you are using a different psp, and that’s the reason I asked for your psp version at the first place. :)

    Anyways, In your earlier post you mentioned -

    rafael becerra said:

    however if include that code then UART0 is able to transmit but GPIO driver blocks itself as if it never detected the rx interruptions,

    Which gpio pins are you using?.

     

    Have you tried building/using only UART1 instance and get it working? i.e, Test UART1 alone, both RX and TX. If not done, please try this. This is just to isolate the problem.

     

    Also, try configuring both the UART’s in polled mode and check its behavior!. And, when you are using both UART’s make sure the Power up settings for UART0 is done appropriately.

     

    Please try this and let us know the results..

     

    Thanks & regards,

    Raghavendra

  • Hi Raghavendra, model number used is : TMS320DM6435ZWTQ. And I think is the main difference.


    Regards.

    Jhaeri

  • Hi Raghavendra the PSP drivers version that we use is psp_1_00_02_00 and I don't know if is OK or is necessary an update? In our designed board we use a TMS320DM6435 processor, is there any difference respect to DM6437?

    Best Regards.

    Jhaeri

  • Hi Jhaeri,

    There is no update as such. As far as my knowledge is concerned, only DM6437 support for PSP_1_00_XX is provided. And with respect to "TMS320DM6435" , I do not think there is much of a difference with respect to UART. But did you try all the steps I mentioned in my previous post?. What were the results?.

    NOTE - psp_1_00_02_00 is tested for DM6437 and c6424 platforms only.

     

    Regards,

    Raghavendra

  • Respect to GPIO pins we are using standalone GPIO for UART0 & UART1 and these are:

    For UART1:

    HECC_RX/TINP1L/URXD1/GP[56] ( K4)

    HECC_TX/TOUT1L/UTXD1/GP[55] ( L4)

    For UART0 :

    URXD0/GP[85] ( L2)

    UTXD0/GP[86] ( K3)

    UCTS0/GP[87] ( L1)

    URTS0/PWM0/GP[88] ( L3)

    PINMUX1 configured as: TIM1BK ( 10b ) for UART1, UR0FCBK ( 01b) for UART0 flow control, UR0DBK ( 1b) for UART0 Data Mode.

    Currently I'm going to test UART1 alone as you I mentioned in your previous post.


    Best Regards.

  • Hi! Again.

    I have a question. First I isolate UART1 and doesn't work, it doesn't trasmit or receive.

    1.- is necessary to init UART ( 0 or 1 or both) before reach the main()? Currently the Initialization Uart function is inside main()

    Best Regards.

  • Hi,

    Well then we will have to debug why UART1 instance is not working first. Since the same driver works for UART0, it would be better to check the config settings of UART1. It does not transmit or receive? what are you observing then(hang/nothing output o console)? Can you please elaborate..

    Jhaeri Reyes said:

    1.- is necessary to init UART ( 0 or 1 or both) before reach the main()? Currently the Initialization Uart function is inside main()

    Are you talking about, "UART_INIT"??.. It is specified in the UART configuration (dm6437_uart0.tci) and it has to be specified for both UART0 and UART1 which you are already doing - as mentioned in your first post. It need not be called inside main() (it is called during device creation).

     

    Best Regards,

    Raghavendra

  • Hi,

    Respect to UART_INIT you're right, it is called during device creation. I have InitUartModule() function (it is called inside main()), in this function it is called GIO_create, to create UART object and it's called too GIO_control to set some features like baud rate or flow control. My apologies for the confusion.


    I was debugging my project, isolated UART1, and I found that GIO_create didn't set the default configuration that DSP/BIOS UART DRIVER documentacion says:

    UART Hardware Setup Defaults
    Module Clock Frequency (Hz)
    (Uint32) 27000000
    Standard baudrate setting
    115.2Kbps
    FIFO Enable
    (Bool) TRUE,
    Loop Back Enable/Disable
    (Bool) FALSE
    Flow Control Enable/Disable
    (Bool) FALSE

    I don't know if driver contains separate configuration for each instance of the hardware. The FIFO Enable or FIFO mode seems not be set by default, when I was inspecting the UART1 FCR register. I modified manually the FIFO EN field of FCR immediately InitUartModule() function was called and and before the first data transmission. in this manner, with FIFO enable, my UART TX task (UARTTX TSK ) was activated and and by observation of the signal on an oscilloscope I could see the data transmission. If FIFO is disabled I saw that my UART TX task was activated once.

    Below is a design of what I try to implement.

    Best regards.

  • Hi Jhaeri,

    All the UART related hardware configurations (default settings and w.r.t "Uart_DevParams") is done in "LLC_uartHwSetup". This is called during device creation itself. You can place a breakpoint at this function, and load the binaries and check with what configurations the UART1 Instance is being enabled. Or check if it being updated appropriately or not. Since I do not have a set up to try here, I am requesting you to try and check. Let me know the results..

     

    Best Regards,

    Raghavendra

     

  • First, I was inspecting the function:

    /* Hardware setup of UART LLC */
    void LLC_uartHwSetup(   LLC_UartHandle      hUart,   Ptr    hHwConfig)
    {
        Uint32  value;
        LLC_UartHwConfig*  hwConfig = (LLC_UartHwConfig*)hHwConfig;

        hUart->hwConfig = hwConfig;

        /* Set the divisor */
        value = hwConfig->cfgBasic.moduleClock / \
        (LLC_UART_BAUD_MULTIPLIER * hwConfig->cfgBasic.baudRate); // 115200
        hUart->regs->DLL = (Uint32)(value & 0xFF); // 0x0000000E == 14
        hUart->regs->DLH = (Uint32) ((value & 0xFF00) >> 8); // 0x00000000

        /* Set the Fifo control - FIFO Disable not supported */
        hUart->regs->FCR = 0; /* Clear FIFO counters */

        value = 0;
        if(hwConfig->cfgBasic.enableFifo == (Bool)TRUE)
        {

          value = (CSL_UART_FCR_FIFOEN_ENABLE); // 0x00000001u
          /* | CSL_UART_FCR_TXCLR_MASK | CSL_UART_FCR_RXCLR_MASK);*/
          switch (hwConfig->cfgBasic.rxThreshold)
           {
             case LLC_UART_RX_TRIG1:
                value |= CSL_UART_FCR_RXFIFTL_CHAR1 << CSL_UART_FCR_RXFIFTL_SHIFT;
                                            /* Receive FIFO trigger level 1 byte */
                break;
             case LLC_UART_RX_TRIG4:
                value |= CSL_UART_FCR_RXFIFTL_CHAR4 << CSL_UART_FCR_RXFIFTL_SHIFT;
                                            /* Receive FIFO trigger level 4 byte */
                break;
             case LLC_UART_RX_TRIG8:
                value |= CSL_UART_FCR_RXFIFTL_CHAR8 << CSL_UART_FCR_RXFIFTL_SHIFT;
                                            /* Receive FIFO trigger level 8 byte */
                break;
             case LLC_UART_RX_TRIG14:
             default:
                value |= CSL_UART_FCR_RXFIFTL_CHAR14 << CSL_UART_FCR_RXFIFTL_SHIFT; // 0x00000003u << 0x00000006u
                                            /* Receive FIFO trigger level 14 byte */ // value== 0x000000C1           
    break;
           }

        }
        if(hwConfig->cfgBasic.enableDma == (Bool)TRUE)
        {
            value |= CSL_UART_FCR_DMAMODE1_MASK;
        }

        hUart->regs->FCR = value; // --> 0x000000C1

        /* Setother parameters based upon configuration */
        hUart->regs->MCR = 0;  /* modem control register not programmed */

        value = ((Uint32) hwConfig->cfgBasic.charLen |
                 (Uint32) hwConfig->cfgBasic.numStopBits |
                 (Uint32) hwConfig->cfgBasic.parity);
        hUart->regs->LCR = value;

        hUart->regs->PWREMU_MGMT |= CSL_UART_PWREMU_MGMT_UTRST_ENABLE;

        return;
    }

    And after analyzing the function, step by step and by hand, I saw that the final value for FCR 0x000000C1. Firstly for an isolated UART0 the FCR had value of 0x000000C1 which indicates that fifo is enabled, and for an isolated UART1 had value of 0x000000C6 which indicates that fifo is disabled and TXCLR y RXCLR are activated.

    I'm going to debug such function as you mentioned previously, to check if it being updated appropriately or not.

     

    Regards.

  • Hi again.

    I tested UART1, alone completely  (and because some little troubles with our hardware, in our approach of RS485 bus) this is transmiting and receiving, but when UART1 and UART0 are together, UART0 reception is disabled.

    I do not know what is happening. Instances of both UARTs are separated, I already checked the configuration that gives the driver and are OK.

  • Hi Jhaeri,

    Since this post is already answered, I would request you to create a new post and continue..

    So, in the process fo getting the UART1 instance working, have you by any chance modified the GEL file?. Or checked the PLL settings for both UARTs?. UART0 reception(read) is disabled, but have you tried doing a write?. Also can you please elaborate what exactly happens to UART0 when UART1 enabled?. Does it hang or return with a error message? Also it would be helpful if you could send a memory dump of UART0 and UART1 registers. 

     

    Best Regards,

    Raghavendra

     

  • Hi Raghavendra. Happy new year!

    I apologize for taking long to answer.

    First, the GEL file is not modified at any time. Yes, I have checked the PLL settings for both UARTs and are ok.
    Yes, I do. UART0 transmission (write) is working fine.
    I observed that when UART1 device is created (or enabled in such case) , UART0 reception is disabled, but UART0 transmission is fine. I have checked memory, registers and seems to be ok. Variables and configuration parameters for both UARTs are in separate files.
    I tested UART0 alone and is working well, same for UART1 alone.
    I attached the memory dump file of UART0 and UART1 registers.
    Yes, I wil create a new post as you mentioned it. 4863.UARTS_MemDump.txt
    Best Regards,
    Jhaeri