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.

BP-CC3301: CC3301 FW transport error

Part Number: BP-CC3301
Other Parts Discussed in Thread: CC3301

Tool/software:

When using  MCU to drive the CC3301, instead of using the example file system method to download firmware to the CC3301, the firmware is converted into an array, and data is directly copied from the array for downloading. During the transmission process, an error consistently occurs with the message: "ERROR Command: timed out, replace context: 2!". During the transmission process, the logic analyzer detected that the data from the MCU was sent correctly, and the SPI configuration was correct. However, the IRQ pin did not show any changes. Should there be any changes in this pin during the transmission process?

  • I scraped the data emitted by the host as follows! First frame  / second frame   / third frame 

  • Hi,

    Do you follow the flow in the code?

    I can see the first command (SDIO CMD0) for which the IRQ line should de-assert. Do you see it?

    Then there are some other commands that you do not have (like reading AMC address) but I don't want to get into it at the moment.

    Do you get the IRQ line asserted and then de-asserted?

    It should go like this for every chunk you write.

    Getting a full Logic (like Saleae capture) should be anough.

    Regards,

    Shlomi

  • The SDK tools folder provides three bin files. Do all three bin files need to be downloaded to the RAM of the 3301?

    Referring to the network_terminal project in the SDK, when debugging on our platform, I found that when preparing to download the firmware, the error 

    "didn't receive ROM init complete"occurs! When downloading "rambtlr", the cc3301 does not respond!

    Below is the firmware download function, with the error message "ERROR Command: timed out, replace context: 2!".

    Can you provide a log of AM243 running normally?

    int32_t init_device(void)
    {
        int ret = 0;
        /* start downloading the RAM btlr and FW */
        Report("Starting software download.....\r\n");
    
        /* we need to wait so the LX device will wake up */
        if(fwEvent_Wait(2000,HINT_ROM_LOADER_INIT_COMPLETE) == -1)
        {
            Report("didn't receive ROM init complete");
            //assert(0);
            while(1);
        }
        // RAM Bootloader download
        ctrlCmdFw_ContainerDownload("rambtlr");
    
        if(fwEvent_Wait(2000,HINT_SECOND_LOADER_INIT_COMPLETE) == -1)
        {
            Report("didn't receive RAM init complete");
            assert(0);
        }
        
        /* FW download */
        ctrlCmdFw_ContainerDownload("fw");
        if(fwEvent_Wait(2000,HINT_FW_WAKEUP_COMPLETE) == -1)
        {
            Report("didn't receive FW Wakeup complete");
            while(1);
        }
        /* Download ini File Params */
        ctrlCmdFw_DownloadIniParams();
    
        if(fwEvent_Wait(2000,HINT_FW_DOWNLOADING_INI_PARAMS_COMPLETE) == -1)
        {
            Report("didn't receive FW Downloading INI Params complete");
            while(1);
        }
        return ret;
    }

  • Before the above function runs, the 'bus_sendInitCommand' function sends initialization information to the cc3301. I have detected the data as shown in the figure.

    Can you help verify it? I want to know if this is the correct data for normal communication.

    After this command is sent, will the cc3301 pull the IRQ pin high or low?

  • Hi,

    This is the right command (CMD0) that configures the SPI interface on the device side.

    The IRQ is not de-asserted after this command (and should remain asserted, i.e. high).

    The only command that de-asserts IRQ is sending the FW_STATUS_ADDR command (0xBFFC).

    See capture from my Loggic.

    Regards,

    Shlomi

  • I didn't understand your answer!

    I have a few questions that I would like to get your confirmation on.

    1、Are all three of these documents required on our platform?

    2、In the int InitHostDriver() function within the init_host.c file, after executing the bus_sendInitCommand(config/not used/, 0); , it enters the init_device(); function.

    In this function, it first waits for the HINT_ROM_LOADER_INIT_COMPLETE event to complete. How is this event triggered?

    3、After receiving this event, the file transfer begins. Will there be a status feedback from 3301 after the host completes transferring a frame of data?

    4、Can you provide a log of AM243 running normally?

  • Hi,

    yes, you need all three.

    The HINT_ROM_LOADER_INIT_COMPLETE is triggered after the chipset is powered on (to indicate that ROM bootloader has finished initialization).

    Basically, to start reading from the chip, there are 2 commands that are sent to the chip (you do not need to actively call those, it is all done internally as part of the driver code):

    • read status register (you should see 0xBFFC at the beginning of the SPI command)
    • read NAB command (0xBFFC)

    Then, another command is sent (which begins with 0xBFF0).

    This goes like this for every command.

    What log are you expecting?

    Shlomi

  • "The HINT_ROM_LOADER_INIT_COMPLETE is triggered after the chipset is powered on (to indicate that ROM bootloader has finished initialization)."

    How is this achieved?

    According to the program flow, first the CC3301 is powered on, and after a 2-second delay, the IRQ pin is enabled. This means the IRQ is enabled 2 seconds after power-on, so the first interrupt will not occur. How can it possibly trigger the event HINT_ROM_LOADER_INIT_COMPLETE?

    int32_t HwInit(void)
    {
        int ret = 0;
    
        /* make sure the device is turned off */
        wlan_TurnOffWlan();
    
        /* disable the IRQ interrupt */
        wlan_IRQDisableInt();
    
        /* turn on the device */
        wlan_TurnOnWlan();
    
        /* enable the IRQ interrupt */
        wlan_IRQEnableInt();
    
        return ret;
    }
    void wlan_TurnOnWlan()
    {
        if(0 == gWlanENGpioAddr)
        {
            /* Get address after translation translate */
            gWlanENGpioAddr = (uint32_t) AddrTranslateP_getLocalAddr(WLAN_EN_BASE_ADDR);
            GPIO_setDirMode(gWlanENGpioAddr, WLAN_EN_PIN, WLAN_EN_DIR);
        }
    
        if(1 == GPIO_pinOutValueRead(gWlanENGpioAddr, WLAN_EN_PIN))
        {
            wlan_TurnOffWlan();
        }
        osi_Sleep(2);
        GPIO_pinWriteHigh(gWlanENGpioAddr, WLAN_EN_PIN);
    
        osi_Sleep(2);
    }

  • Could you release a version that doesn't use the LIB library, but instead includes all the C source files in the project? This would improve code readability, as otherwise, the code can only be read during step-by-step debugging!

  • See capture from my Loggic ,In the image, from the start of the CC3301 to the rising edge interrupt generated by the CC3301, the interval is 31ms, which is much less than the 2ms specified in the code!

    Could you provide a screenshot of it running normally? I want to confirm how the IRQ triggers the HINT_ROM_LOADER_INIT_COMPLETE event!

  • Hi,

    Attached you can see the capture. I can see ~30mSec between releasing the nReset and the IRQ getting asserted.

    It may be that the issue is related to the actual osi_sleep() function.

    I can see that the implementation is:

    OsiReturnVal_e osi_Sleep(OsiTime_t sec)
    {
        TickType_t xDelay;
    
        if (sec > 0xFFFFFFFF / configTICK_RATE_HZ) {
            xDelay = 0xFFFFFFFF;
        }
        else {
            xDelay = sec * configTICK_RATE_HZ;
        }
    
        vTaskDelay(xDelay);
        return OSI_OK;
    }

    Since configTICK_RATE_HZ is 1000, it means that each tick is 1mSec so I believe that the actual delay here is in mSec and not seconds.

    Regards,

    Shlomi

  • Hi, Shlomi Itzhak

    Thanks for your replay!

    Your screenshot only covers part of the process after powering on.

    I need a complete screenshot that starts from before powering on to the first firmware packet delivery!

    Regarding the 2-second delay, if there's an issue with the units here, why is the example you provided running correctly on the AM243?

    From your screenshot, it can be seen that the host sends the first frame of data when the IRQ generates a falling edge.

    By reviewing the example code for the AM43, I found that the host sends the first frame of data immediately after the IRQ first generates a rising edge, which is used to initialize the bus. Below is the relevant portion of the code.

        /* Set HW init */
        ret = HwInit();//turn on slave
        
        if(ret < 0)
        {
            Report("HwInit failed \n\r");
            assert(0);
        }
    
        Report("Hardware init DONE! \n\r");
    
        /* send command to init bus */ //TODO AMIR , input need to be change when we will use sdio/spi/hif
        bus_sendInitCommand(config/*not used*/, 0);
    
        ret = init_device();

    Thanks,

    Gavin

  • Hi,

    Let me record again the full initialization and I will share it.

    Regards,

    Shlomi

  • Hi,

    Please see the full logic capture. You need to use saleae to open it.

    From the screenshot, it is hard to see the details but the host sends the init command first and this does not deassert the IRQ, it is the next command that does (starts with address 0xBFFC.cc33xx_MCU_full_platform_init_network_terminal.sal

    Regards,

    Shlomi

  • Hi, Shlomi

    I have compared and found a few issues: The host's IRQ pin is pulled high by the 3301, and there are differences in the frames below.

    The top is your screenshot, and the bottom is my screenshot. The two differences have been marked.

    I have already replaced osi_Sleep with vTaskDelay in the wlan_TurnOnWlan function, and the unit has also been changed to milliseconds.

    Could you help me analyze where the error might be?

    Is the HINT_ROM_LOADER_INIT_COMPLETE event an event completed by the host itself after powering on, or is it an event after an interrupt generated by the 3301?

    If I place the three files of the 3301 at a fixed address in the host flash and use the const modifier, is this event still necessary?

    Thanks,

    Gavin

  • Hi,

    I see the difference and can check internally if it matters.

    From the capture it seems you are working in a very low SPI rate (500K?, 1M?).

    Is this on purpose?

    Shlomi

  • spi rate 500K is on purpose! This does not affect data interactions.

    Is the HINT_ROM_LOADER_INIT_COMPLETE event an event completed by the host itself after powering on, or is it an event after an interrupt generated by the 3301?

    If I place the three files of the 3301 at a fixed address in the host flash and use the const modifier, is this event still necessary?

  • Hi,

    The interrupt is asserted by the CC3301 upon ROM bootloader done.

    You need to follow the process of loading each one of these files upon getting the right interrupt.

    Shlomi