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.

AM6421: Errata i2409 resolution in MCU Plus SDK

Part Number: AM6421

Hello,

I see that errata i2409 was resolved in the Linux SDK.  In our application, we are running USB from the R5 core and FreeRTOS.  I searched through the latest MCU Plus SDK 12.0 and do not see that a similar i2409 fix has been implemented.  If that is the case, please provide instruction for how that can be done as similar files (drd.h, drd.c, core.h,cdns3-ti.c) do not exist in MCU Plus SDK.

Thank you,

Joe

  • Hi Joe,

    Yes, you are correct. The workaround sequence is not implemented in the current SDK. 

    The suspend residency register can be accessed at any time during normal operation (out of reset). For that reason it needs to be accessed carefully to don't impact correct operation of the controller.

    It need to be ensured that configuration register is accessed before controller is enabled for operation by SW. Please find the below sequence of operations.

    1. power on
    2. controller reset inputs.de-asserted
    3. write to suspend residency register
    4. controller enabled for operation using DEVEN bit for device mode.

    I am providing the code below which sets the suspend_residency_enable bit of SUSP_CTRL register after the reset release of USB inside usbConfig() function found at ${MCU+SDK}/source/usb/cdn/soc/am64x_am243x/usb_wrapper.c. This bit needs to be set before the controller is enabled for operation by SW as mentioned in above sequence. (i.e. before controller enabled for operation using DEVEN bit for device mode)

    Please find the below code to implement workaround of published errata.

    static int32_t usbConfig(usb_init_param_t *usbInitParamsPtr)
    {
        uint32_t usbBaseRegs = 0;
        uint32_t usbCmnRegs = 0;
        uint32_t modeStrap = 0;
    
        usbBaseRegs = CSL_USB0_VBP2APB_WRAP_CONTROLLER_VBP_CORE_ADDR_MAP_BASE;
        usbCmnRegs = CSL_USB0_MMR_MMRVBP_USBSS_CMN_BASE;
    
        /* assert reset to the USB controller */
        usbss_reset_assert(&usb_handle);
    
        /* set the USB controller to host or device mode */
        if(usbInitParamsPtr->isHostMode == 1)
        {
           modeStrap =  MODESTRAP_SEL_HOST_MODE;
        }
        else
        {
           modeStrap =  MODESTRAP_SEL_DEVICE_MODE;
        }
    
        HW_WR_FIELD32(usbCmnRegs + CSL_USB3P0SS_CMN_USB3P0SS_W1,
                      CSL_USB3P0SS_CMN_USB3P0SS_W1_MODESTRAP, modeStrap);
    
        HW_WR_FIELD32(usbCmnRegs + CSL_USB3P0SS_CMN_USB3P0SS_W1,
                      CSL_USB3P0SS_CMN_USB3P0SS_W1_MODESTRAP_SEL,
                      MODESTRAP_USES_MODE_S_SEL);
    
        /* set to USB2.0 only if USB3.0 is not enabled. i.e SERDES is not used */
        HW_WR_FIELD32(usbCmnRegs + CSL_USB3P0SS_CMN_USB3P0SS_W1,
                      CSL_USB3P0SS_CMN_USB3P0SS_W1_USB2_ONLY_MODE, usbInitParamsPtr->usb2Enable);
    
        /* release reset */
        usbss_reset_release(&usb_handle);
    
        /* wait for Controller Not Ready to go 0 */
        while(HW_RD_FIELD32(usbBaseRegs + CSL_USB3P0SS_CTRL_DRD_OTGSTS,
            CSL_USB3P0SS_CTRL_DRD_OTGSTS_OTG_NRDY));
    
        /* setting suspend_residency_enable field in SUSP_CTRL to '1' */
        HW_WR_FIELD32(&usb_handle.p_usbregs_ctlr -> DRD.SUSP_CTRL, CSL_USB3P0SS_CTRL_DRD_SUSP_CTRL_SUSPEND_RESIDENCY_ENABLE, 0x1);
    
        /* for USB host, needs to wait for XHC_READY */
        if(usbInitParamsPtr->isHostMode == 1)
        {
            /* wait for Controller XHC_READY to go 1 */
            while(!HW_RD_FIELD32(usbBaseRegs + CSL_USB3P0SS_CTRL_DRD_OTGSTS,
                CSL_USB3P0SS_CTRL_DRD_OTGSTS_XHC_READY));
        } else {
            /* wait for Controller DEV_READY to go 1 */
            while(!HW_RD_FIELD32(usbBaseRegs + CSL_USB3P0SS_CTRL_DRD_OTGSTS,
                CSL_USB3P0SS_CTRL_DRD_OTGSTS_DEV_READY));
        }
    
        return 0;
    }

    Regards,

    Tushar

  • Tushar,

    Thank you very much.  We will give this a try and report back.