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.

Starterware bug when mixing RNDIS mode together with any other mode

Other Parts Discussed in Thread: OMAPL138, OMAP-L138

I have discovered a bug in Starterware. The bug occurs when you try to mix RNDIS mode together with any other mode.  For example, if you are setting RNDIS mode (on any endpoint or any direction -- transmit or receive), then trying to use any other mode (on any other endpoint, or in any direction), will experience this bug.  You will not get the other mode.  You will only get RNDIS. The Starterware bug occurs in OMAPL138_StarterWare_1_10_04_01, though it might also occur in other Starterware packages too

The bug occurs in the file, cppi41dma.c, in the function Cppi41DmaModeSet(), in the first if statement.  If you are mixing together RNDIS mode with any other mode, then this first if-statement will set global RNDIS mode -- which overrides all other modes on all endpoints, and in all directions.   In other words, you will not get any other mode but RNDIS, because Starterware inadvertently sets global RNDIS mode. 

Here is the reference:

"Using the global RNDIS bit in the control register (CTRLR) overrides this register [i.e., the MODE register] and enables
RNDIS mode for all endpoints." (from the OMAP-L138 Tech Ref Manual, section 35.4.5, underlining added)

The cure is to remove the first 'if' block from that function, and place it into a separate function.  Like this:

/**
* \brief This API will enable (or disable) Global RNDIS mode on all endpoints
*
* \param bEnable - a Boolean indicating whether to enable (or disable) global RNDIS mode
*
* \return None.
*
**/
void Cppi41DmaSetGlobalRNDIS( unsigned int bEnable )
{

if ( bEnable )
{

           HWREG(usbInstance->otgBaseAddress + USB_0_CTRL) |=
                                                                CPDMA_MODE_ENABLE_GLOBAL_RNDIS;

}

/* Disable RNDIS from Global Level */

else
{

            HWREG(usbInstance->otgBaseAddress + USB_0_CTRL) &=
                                                                ~CPDMA_MODE_ENABLE_GLOBAL_RNDIS;

}


}

You would then use either this new function -- Cppi41DmaSetGlobalRNDIS(), to set all directions and endpoints simultaneously, at once -- or use the old function -- Cppi41DmaModeSet(), to set each endpoint/direction separately -- but not both functions.  You would use one function or the other. 

-- Walter Snafu