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.

problem on cc3000 patch programmer 1.11.1

Other Parts Discussed in Thread: MSP430F249

Hello,

I am porting driver cc3000 Ti module to msp430f249 using cc3000 patch programmer 1.11.1, when it got on LINE1 hang on at LINE2. i don't know why it hang on. this is lastest version.

Thanks

///

unsigned char nvmem_get_mac_address(unsigned char *mac)
{
    return  nvmem_read(NVMEM_MAC_FILEID, MAC_ADDR_LEN, 0, mac);
}

void main(void)
{
    WDTCTL = WDTPW + WDTHOLD;

    unsigned short  index;
    unsigned char   *pRMParams;

    // init board and request to load with no patches.
    // this is in order to overwrite restrictions to write to specific places in EEPROM
    initClk();
    initLEDs();
    initUart();
    initDriver(2);

    // read MAC address
    mac_status = nvmem_get_mac_address(cMacFromEeprom); // LINE1
    turnLedOn(LED3);
    return_status = 1;

    while ((return_status) && (counter < 3))
    {
        // read RM parameters
        // read in 16 parts to work with tiny driver

        return_status = 0;
        pRMParams = cRMParamsFromEeprom;

        for (index = 0; index < 16; index++)
        {
            return_status |= nvmem_read(NVMEM_RM_FILEID, 8, 8*index, pRMParams);
            pRMParams += 8;
        }
        counter++;

------------------------

------

////

signed long
nvmem_read(unsigned long ulFileId, unsigned long ulLength, unsigned long ulOffset, unsigned char *buff)
{
    unsigned char ucStatus = 0xFF;
    unsigned char *ptr;
    unsigned char *args;
    
    ptr = tSLInformation.pucTxCommandBuffer;
    args = (ptr + HEADERS_SIZE_CMD);
    
    // Fill in HCI packet structure
    args = UINT32_TO_STREAM(args, ulFileId);
    args = UINT32_TO_STREAM(args, ulLength);
    args = UINT32_TO_STREAM(args, ulOffset);
    
    // Initiate a HCI command
    hci_command_send(HCI_CMND_NVMEM_READ, ptr, NVMEM_READ_PARAMS_LEN);
    SimpleLinkWaitEvent(HCI_CMND_NVMEM_READ, &ucStatus);
    
    // In case there is data - read it - even if an error code is returned
   // Note: It is the user responsibility to ignore the data in case of an error code
    
    // Wait for the data in a synchronous way. Here we assume that the buffer is
    // big enough to store also parameters of nvmem
    
    SimpleLinkWaitData(buff, 0, 0); // LINE2
    
    return(ucStatus);
}

///

  • Hello,

    I saw that a group of people called that is a missing interrupt problem, but I don't know how to solve that

    Thanks

  • Hello,

    I downloaded cc3000 patch 1.11 and ported it on my platform. However, it hang on this function

    "nvmem_read(unsigned long ulFileId, unsigned long ulLength, unsigned long ulOffset, unsigned char *buff)".

    I modified spi.c file following SPI.c in cc3000 patch 1.11.1 version.

    Can anyone can help me?

    Thanks

  • Hi Lau,

    It does look like you are not receiving the interrupts. It looks like you are waiting in the loop inside 'hci_event_handler'. This will happen until you get the MAC address data over Spi and 'tSLInformation.usEventOrDataReceived' gets populated.

    - You would have to check, if the CC3000 has indeed missed an interrupt, by probing the IRQ line.

    - If the interrupts are being raised by CC3000, then you would have to check the host driver, where interrupts might have been disabled, and the driver is not able to determine the interrupt.

    Thanks & Regards,

    Raghavendra

  • Hello Raghavendra,

    I am using cc3000 patch 1.10.1

    Should I port cc3000 patch 1.10.2 first and then 1.11.1 or directly to 1.11.1?

    Any problem happen?

    Thanks

  • Hi,

    There shouldn't be any problem. You can directly port to 1.11.1. Make sure you use Service Pack 1.24 with it.

    Thanks & Regards,

    Raghavendra

  • You downloaded host driver 1.11.1 on Ti website and modified my SPI library as TI's SPI library. but it stuck on event_handler() when mac_status = nvmem_get_mac_address(cMacFromEeprom);

    here is SPI-write() and spi interrupt vector. You check anything's wrong in my interrupt vector. my MCU is msp430f249.

    ///

    long
    SpiWrite(unsigned char *pUserBuffer, unsigned short usLength)
    {
        unsigned char ucPad = 0;
        
        // Figure out the total length of the packet in order to figure out if there
        // is padding or not
        if(!(usLength & 0x0001))
        {
            ucPad++;
        }
        
        pUserBuffer[0] = WRITE;
        pUserBuffer[1] = HI(usLength + ucPad);
        pUserBuffer[2] = LO(usLength + ucPad);
        pUserBuffer[3] = 0;
        pUserBuffer[4] = 0;
        
        usLength += (SPI_HEADER_SIZE + ucPad);
        
        // The magic number that resides at the end of the TX/RX buffer (1 byte after
        // the allocated size) for the purpose of detection of the overrun. If the
        // magic number is overwritten - buffer overrun occurred - and we will stuck
        // here forever!
        if (wlan_tx_buffer[CC3000_TX_BUFFER_SIZE - 1] != CC3000_BUFFER_MAGIC_NUMBER)
        {
            while (1)
                ;
        }
        
        if (sSpiInformation.ulSpiState == eSPI_STATE_POWERUP)
        {
            while (sSpiInformation.ulSpiState != eSPI_STATE_INITIALIZED)
                ;
        }
        
        if (sSpiInformation.ulSpiState == eSPI_STATE_INITIALIZED)
        {
            // This is time for first TX/RX transactions over SPI: the IRQ is down -
            // so need to send read buffer size command
            SpiFirstWrite(pUserBuffer, usLength);
        }
        else
        {
            // We need to prevent here race that can occur in case 2 back to back
            // packets are sent to the  device, so the state will move to IDLE and once
            //again to not IDLE due to IRQ
            tSLInformation.WlanInterruptDisable();
            
            while (sSpiInformation.ulSpiState != eSPI_STATE_IDLE)
            {
                ;
            }
            
            sSpiInformation.ulSpiState = eSPI_STATE_WRITE_IRQ;
            sSpiInformation.pTxPacket = pUserBuffer;
            sSpiInformation.usTxPacketLength = usLength;
            
            // Assert the CS line and wait till SSI IRQ line is active and then
            // initialize write operation
            ASSERT_CS();
            
            // Re-enable IRQ - if it was not disabled - this is not a problem...
            tSLInformation.WlanInterruptEnable();

            // check for a missing interrupt between the CS assertion and enabling back the interrupts
            if (tSLInformation.ReadWlanInterruptPin() == 0)
            {
                        SpiWriteDataSynchronous(sSpiInformation.pTxPacket, sSpiInformation.usTxPacketLength);

                sSpiInformation.ulSpiState = eSPI_STATE_IDLE;

                DEASSERT_CS();
            }
        }
        
        // Due to the fact that we are currently implementing a blocking situation
        // here we will wait till end of transaction
        while (eSPI_STATE_IDLE != sSpiInformation.ulSpiState)
            ;
        
        return(0);
    }

    ////

    #pragma vector=PORT2_VECTOR
    __interrupt void IntSpiGPIOHandler(void)
    {
        //__bic_SR_register(GIE);
        if (P2IFG&0x01)
        {
            P2IFG &= ~BIT0;
            if (sSpiInformation.ulSpiState == eSPI_STATE_POWERUP)
            {


                /* This means IRQ line was low call a callback of HCI Layer to inform on event */
                 sSpiInformation.ulSpiState = eSPI_STATE_INITIALIZED;
            }
            else if (sSpiInformation.ulSpiState == eSPI_STATE_IDLE)
            {
                sSpiInformation.ulSpiState = eSPI_STATE_READ_IRQ;

               /* IRQ line goes down - we are start reception */
                ASSERT_CS();

                // Wait for TX/RX Compete which will come as DMA interrupt
                SpiReadHeader();

                sSpiInformation.ulSpiState = eSPI_STATE_READ_EOT;

                SSIContReadOperation();
            }
            else if (sSpiInformation.ulSpiState == eSPI_STATE_WRITE_IRQ)
            {

                SpiWriteDataSynchronous(sSpiInformation.pTxPacket, sSpiInformation.usTxPacketLength);
                sSpiInformation.ulSpiState = eSPI_STATE_IDLE;

                DEASSERT_CS();
            }
        }

    }

    ////

  • You can check the position I make clear interrupt flag?

    Thanks

  • I already solved this problem. That's wrong in my interrupt vector. I make a incorrect position that cause a missing interrupt.

  • Hello Raghavendra,

    Even though I passed all nvm_write() and nvm_read(), but I still got a problem at the end of the code at LINE1

    it stuck in event_handler() with SimpleLinkWaitEvent(HCI_CMND_SIMPLE_LINK_START, 0) command.

    At the beginning of the program,  initDriver(2) was passed completely, but at the end  initDriver(0); // LINE1 stuck.

    don't know why? anything wrong in my interrupt vector. If it passed over this line, then the patch is completely finished.

    Thanks

    ///

    while (ucStatus_Dr)
        {
            //writing driver patch to EEPRROM - PROTABLE CODE
            // Note that the array itself is changing between the different Service Packs
            ucStatus_Dr = nvmem_write_patch(NVMEM_WLAN_DRIVER_SP_FILEID, drv_length, wlan_drv_patch);
        }

        sendString("patch memory");
        turnLedOn(6);

        // init board and request to load with patches.
        initDriver(0); // LINE1

        //If MAC does not exist, turn on LED1. It is recommended that the user will write a valid mac address.
        if (mac_status != 0)
            turnLedOn(1);
        sendString("finished all");
        turnLedOn(8);

    ////