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.

CC3120MOD: Device doesn't respond after sl_start

Part Number: CC3120MOD
Other Parts Discussed in Thread: CC3200, CC3100, CC3120, UNIFLASH

Hello everyone.

I have made a custom board with CC3120MOD , connected it to atsame70 cortex-m7 mcu via SPI interface.

Generally speaking I have: 

VABT1,VBAT2, VBAT_RESET to 3.3V

pins1,2,16,27,28,30,32,38,43,0 to GND

nHIB via 10k to 3.3V

pin5-SPI_SCLK pin6-SPI_MOSI pin7-SPI_MISO pin8-SPI_NCS1 pin11-IRQ to GPIO pin35-RESET to GPIO

pin31 - via filter to SMA 73251-2120 connector to antenna ANT-SS2.4G

I ported all code from simplelink_msp432p4_sdk_1_50_00_12 and simplelink_sdk_wifi_plugin_1_50_00_38 with freertos accordingly to porting guide from SimpleLink Wi-Fi Network Processor Programmer's Guide. I mainly based my init code on network_terminal example.

After toggling nReset pin in sl_DeviceDisable() , sl_DeviceEnable() in sl_Start(), I get and IRQ in which it spawns a read in sl_Task(). So I read INITCOMPLETE message.

Everything goes right up to this moment.

Then I call sl_WlanPolicySet(SL_WLAN_POLICY_CONNECTION,SL_WLAN_CONNECTION_POLICY(1,0,0,0),NULL,0) function and get no response from CC3120MOD.

Function _SlDrvMsgRead() returns SL_DEVICE_EVENT_FATAL_SYNC_LOSS because there are no data on MISO pin (zeroes).

So the communication with the device looks like this:

1 got an IRQ

2 MCU sends data MOSI: 0x65,0x87,0x78,0x56

3.MISO: 0xBC,0xDC,0xCD,0xAB  0x08,0x00,0x14,0x08  0x28,0x00,0x04,0x06,0x00,0x00,0x00,0x00,0x11,0x11,0x11,0x11,0x00,0x00,0x00,0x31,0x00,0x00,0x00,0x00

So I get right D2H sync, HDR with opcode INITCOMPLETE and 20 more bytes in STATUS,DESCRIPTORS and PAYLOAD.

Do I get correct response here ? Does anyone know what STATUS=0x28,0x00,0x04,0x06 exactly mean ? May it be a calibration error ?

Please I would kindly appricate help from you !

  • Hello,

    The array starting with 0x28 looks OK as this is the descriptors of the init response.

    the strange thing is the length right to the opcode.

    The opcode is 0x0008 for INIT_COMPLETE but the length is 0x0814 which is way too larger.

    I would expect 0x0014 as you can see from your received buffer.

    It looks like your SPI gets extra 1 bit on the length field.

    Regards,

    Shlomi

  • Sorry, I made a writing mistake the response is indeed :

    MISO: 0xBC,0xDC,0xCD,0xAB  0x08,0x00,0x14,0x00  0x28,0x00,0x04,0x06,0x00,0x00,0x00,0x00,0x11,0x11,0x11,0x11,0x00,0x00,0x00,0x31,0x00,0x00,0x00,0x00

    On the forums on another post I had seen a response : 0xBC,0xDC,0xCD,0xAB  0x08,0x00,0x08,0x00  0x00,0x00,0x00,0x00,0x11,0x11,0x11,0x11 so I thought that one may be correct.

    Do you have any other ideas why there is no communication after geting init complete ?

    I am sending sl_WlanPolicySet command: MOSI : 0x21,0x43,0x34,0x12 ,0x86,0x8C,0x04,0x00,0x10,0x10,0x01,0x00,0x65,0x87,0x78,0x56 and getting zeroes on MISO.

    No matter which command I send after sl_Start(tried also  sl_DeviceGet, sl_WlanProvisioning)  I can't get any data from the device

    I am also using nRESET pin for resetting and nHIB pin is in permament high pullup state.

    Best Regards,

    Marcin

  • Hello,

    Now it makes more sense.

    The shorter version of the INIT_COMPLETE is for prevous generation of CC3100/CC3200 but your sequence should be OK.

    When you send a 2nd command, do you see the interrupt to the host asserted again? how does the interrupt look like?

    It should be asserted and then deasserted from the NWP upon sending the h2n sync (0x65,0x87,0x78,0x56).

    Regards,

    Shlomi

  • From the debugger using breakpoints and semihosting (printf) I conclude the following:

    1.IRQ handler called

    2. MCU sends MOSI: 0x65 0x87 0x78 0x56  in sl_Task()

    3. Another IRQ handler gets called

    4.MCU reads INITCOMPLETE in four consecutive Spi_Read() function calls:

    MISO: 0x0  0xbc 0xdc 0xcd 0xab 0x8  0x0  0x14
    MISO: 0x0  
    MISO: 0x28 0x0  0x4  0x6  0x0  0x0  0x0  0x0  
    MISO: 0x11 0x11 0x11 0x11 0x0  0x0  0x0  0x31 0x0  0x0  0x0  0x0 

    5.Program calls function sl_WLanPolicySet(..)

    Code goes to line 1257 in driver.c:

    /* send the message */
        RetVal = _SlDrvMsgWrite(pCmdCtrl, pCmdExt, pTxRxDescBuff);
    
        if(SL_OS_RET_CODE_OK == RetVal)
        {
            /* wait for respond */
            RetVal = _SlDrvMsgReadCmdCtx(pCmdCtrl->Opcode, IsLockRequired); /* will free global lock */
    ....

    After calling _SlDrvMsgWrite MCU sends:

    MOSI: 0x21 0x43 0x34 0x12
    MOSI: 0x86 0x8c 0x4  0x0  
    MOSI: 0x10 0xa  0x1  0x0  
    MOSI: 0x65 0x87 0x78 0x56

    _SlDrvMsgReadCmdCtx causes fail in reading data from SPI:

    MISO: 0x0  0x0  0x0  0x0  0x0  0x0  0x0  0x0  
    MISO: 0x0  0x0  0x0  0x0 

    No IRQs are being called after calling sl_WlanPolicySet()..

    Kind Regards,

    Marcin

  • Well, you mentioned IRQ handler is called twice.

    After the 1st time it sends 0x65 0x87 0x78 0x56 and after the 2nd time it sends the rest.

    Basically, you should get a single IRQ that in return sends the h2n sync followed by the rest. You should not get the IRQ twice.

    Also, you need to make sure that the IRQ gets deasserted when sending 0x65 0x87 0x78 0x56.

    Loggic capture would be the best here and not just printouts from the driver.

  • On oscilloscope I get only 1 IRQ.

    Logic goes from Low to High for approximately 188ms .

    MOSI data toggle 2.5ms before IRQ is deasserted ( goes back to Low).

    Is that right or should I send data after falling edge of IRQ ?

  • Shlomi Itzhak said:

    When you send a 2nd command, do you see the interrupt to the host asserted again? how does the interrupt look like?

    It should be asserted and then deasserted from the NWP upon sending the h2n sync (0x65,0x87,0x78,0x56).

    Regards,

    Shlomi

    I had an interrupt on both edges enabled that's why I got 2 IRQs called but I already fixed it.

    I still can't get 2nd interrupt after sending sl_WlanPolicySet (or sl_DeviceGet). I can't see anything on the scope.

    The device doesn't rect to command at all.

    Transaction capture of sl_DeviceGet (opcode=8466)

    MOSI: 0x21 0x43 0x34 0x12
    MOSI: 0x66 0x84 0x8  0x0  
    MOSI: 0xa5 0xa5 0x1  0x0  0xc  0x0  0x0  0x0 

    Transaction capture of sl_WlanPolicySet(SL_WLAN_POLICY_CONNECTION,SL_WLAN_CONNECTION_POLICY(1,0,0,0),NULL,0) (opcode=8c86)

    MOSI: 0x21 0x43 0x34 0x12
    MOSI: 0x86 0x8c 0x4  0x0  
    MOSI: 0x10 0xb  0x1  0x0 

    Are these cmd ok ? Maybe I send some data wrong here so the CC3120MOD hangs ?

    Regards,

    Marcin

  • Hello,

    So it seems you do not get the 2nd interrupt after sending the other commands.

    The commands are OK and you should certainly get an interrupt which should trigger another h2n sync from the host.

    Is it possible that the interrupt is masked/disabled from your host?

    There is @_SlDrvRxIrqHandler() a masking of the interrupt, sl_IfMaskIntHdlr() and unmasking when the read is over @_SlDrvMsgRead(), sl_IfUnMaskIntHdlr().

    Maybe for some reason the unmasking is linked to NULL or not implemented?

    This is just a guess of course.

    Shlomi

  • Hi, Shlomi

    Shlomi Itzhak said:

    Is it possible that the interrupt is masked/disabled from your host?

    There is @_SlDrvRxIrqHandler() a masking of the interrupt, sl_IfMaskIntHdlr() and unmasking when the read is over @_SlDrvMsgRead(), sl_IfUnMaskIntHdlr().

    Maybe for some reason the unmasking is linked to NULL or not implemented?

    The interrupt is neither masked nor unmasked.

    void NwpMaskInterrupt()
    {
    }
    void NwpUnMaskInterrupt()
    {
    }

    Another idea which came to my mind is that antena and connector (SMA 73251-2120 ,  ANT-SS2.4G) has combined impedance of 100Ohm.

    What happen if you unplug the antenna from working board with CC3120 and try to boot the device ? Deos the device respond to commands ?

    Also, strangely I observed no current consuption rise from power supply during a startup. It is around 450mW for cc3120MOD and AT91SAME70.

    However, in datasheet it is written that during startup and calibaration CC3120 consumes about 1,5 Watt of power.

    Kind regards, Marcin

  • Sorry, but I do not see the relation between the antenna and the fact that the device do not respond to commands after being initialized for the first time.

    CC3120 calibration really depends on the calibration mode you are configured to.

    Only in NORMAL mode (unlike Triggered or one-time), the calibration gets to high values as a large current (400-450mA) is drawn.

    So you may be configured to either Triggered or one-time. You can check it from the Uniflash project.

    Regards,

    Shlomi

  • Hey, I finally solved my problem.

    In Atmel SAME70 you need to enable  WDRBT: Wait Data Read Before Transfer otherwise the communication breaks:

    • WDRBT: Wait Data Read Before Transfer
    0: No Effect. In Master mode, a transfer can be initiated regardless of the SPI_RDR state.
    1: In Master mode, a transfer can start only if the SPI_RDR is empty, i.e., does not contain any unread data. This mode
    prevents overrun error in reception.

    So my SPI init looks like this:

    SPI_Configure(SPI0, ID_SPI0, (SPI_MR_MSTR  | SPI_PCS(1) | SPI_MR_MODFDIS | SPI_MR_PS | SPI_MR_WDRBT));
    SPI_ConfigureNPCS(SPI0,1,SPI_DLYBCT(2000, BOARD_MCK) | SPI_DLYBS(2000, BOARD_MCK) | SPI_SCBR(10000000, BOARD_MCK) | SPI_CSR_NCPHA);

    SPI_MR_MODFDIS -> disable fault detection

    SPI_MR_PS -> NPCS goes high only after last byte in burst was sent by SPI_WriteLast call;(not mandatory)

    Also you need to add:

    while ((spi->SPI_SR & SPI_SR_TDRE) == 0)
    {
       spi->SPI_RDR & 0xFFFF;
    }

    to the end of SPI_Write, SPI_WriteLast functions to empty SPI receiver.

    I hope this knowledge will help to resolve any issues with communication on Atmel platforms like SAM4, SAM3, SAME7 with SimpleLink devices.

    Thanks for help.

  • Dear Marcin,
    Would it be possible to send me your code?
    I'm also interested in using the SAME70 in conjunction with the CC3120. Your code would greatly speed up my project.
    Many thanks in advance.