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.

CC3100MOD: Wi-Fi Channel Selection from Firmware

Part Number: CC3100MOD

Hi,

  We are shipping our custom made hardware to the customer. This hardware uses CC3100MOD over SPI communication bus with some STM32 MCU. The customer's country regulations require the device to be tested (RF related tests). For this, they require the Wi-Fi to be configured for all individual Wi-Fi channels (namely 1 to 13) for the tests. The regulatory authority may check the transmitted power levels for each channel usage.

  Is there any way to configure the CC3100MOD to use any particular Wi-Fi channel from firmware? (Note: We are using AP mode & station mode only. P2P is not used in our application)

-

Thanks

-

Regards

Soumyajit

  • Hi Soumyajit,

    Please see code for radio tool for CC3200 device. There you can get inspiration how code into your STM32 firmware should look like.

    This part of code may to be interesting for you:

    signed long RadioStartTX(RadioTxMode_e eTxMode,
    		signed char powerLevel_Tone,
    		Channel_e eChannel,
    		SlRateIndex_e eRate,
    		RadioPreamble_e ePreamble,
    		RadioDataPattern_e eDataPattern,
    		unsigned short size,
    		unsigned long delay_amount,
    		unsigned char overrideCCA,
    		unsigned char *pDstMac)
    {
        unsigned short loopIdx;
        signed long length;
        unsigned long numberOfFrames = delay_amount;
        unsigned char pConfigLen = SL_BSSID_LENGTH;
        CurrentTxMode = (unsigned char) eTxMode;
        signed long minDelay;
    
        if ((RADIO_TX_PACKETIZED == eTxMode) || (RADIO_TX_CONTINUOUS == eTxMode))
        {
            /* build the frame */
            switch (eDataPattern)
            {
                case ALL_0_PATTERN:
                    memset(DataFrame, 0, sizeof(DataFrame));
                    break;
                    
                case ALL_1_PATTERN:
                    memset(DataFrame, 1, sizeof(DataFrame));
                    break;
                    
                case INCREMENTAL_PATTERN:
                    for (loopIdx = 0; loopIdx < FRAME_SIZE; loopIdx++)
                            DataFrame[loopIdx] = (unsigned char)loopIdx;
                    break;
                    
                case DECREMENTAL_PATTERN:
                    for (loopIdx = 0; loopIdx < FRAME_SIZE; loopIdx++)
                            DataFrame[loopIdx] = (unsigned char)(FRAME_SIZE - 1 - loopIdx);
                    break;
                    
                default:
                    memset(DataFrame, 0, sizeof(DataFrame));
            }
    
            sl_NetCfgGet(SL_MAC_ADDRESS_GET, NULL,&pConfigLen, &TemplateFrame[TA_OFFSET]);
            memcpy(&TemplateFrame[RA_OFFSET], pDstMac, SL_BSSID_LENGTH);
            memcpy(&TemplateFrame[DA_OFFSET], pDstMac, SL_BSSID_LENGTH);
    
            memcpy(DataFrame, TemplateFrame, sizeof(TemplateFrame));
    
            /* open a RAW/DGRAM socket based on CCA override*/
            if (overrideCCA == 1)
                rawSocket = sl_Socket(SL_AF_RF, SL_SOCK_RAW, eChannel);
            else
                rawSocket = sl_Socket(SL_AF_RF, SL_SOCK_DGRAM, eChannel);
    
            if (rawSocket < 0)
            {
                return -1;
            }
        }
    
        if (RADIO_TX_PACKETIZED == eTxMode)
        {
            length = size;
            txStarted = 1;
    
            while ((txStarted) && (length == size))
            {
                /* transmit the frame */
                minDelay = (delay_amount%50);
                length = sl_Send(rawSocket, DataFrame, size, SL_RAW_RF_TX_PARAMS(eChannel, eRate, powerLevel_Tone, ePreamble));
                osi_Sleep(minDelay);
    
                minDelay = (delay_amount - minDelay);
                while ((minDelay > 0) && (txStarted))
                {
                    osi_Sleep(50);
                    minDelay -= 50;
                }
            }
    
            if (length != size)
            {
                RadioStopTX((RadioTxMode_e)CurrentTxMode);
    
                return -1;
            }
    
            if(sl_Close(rawSocket) < 0)
            {
                return -1;
            }
    
            return 0;
        }
    
        if (RADIO_TX_CONTINUOUS == eTxMode)
        {
            sl_SetSockOpt(rawSocket, SL_SOL_PHY_OPT, SL_SO_PHY_NUM_FRAMES_TO_TX, &numberOfFrames, sizeof(unsigned long));
            sl_Send(rawSocket, DataFrame, size, SL_RAW_RF_TX_PARAMS(eChannel, eRate, powerLevel_Tone, ePreamble));
        }
    
        if (RADIO_TX_CW == eTxMode)
        {
            rawSocket = sl_Socket(SL_AF_RF,SL_SOCK_RAW,eChannel);
            if(rawSocket < 0)
            {
                return -1;
            }
    
            sl_Send(rawSocket, NULL, 0, powerLevel_Tone);
        }
    
        return 0;
    }
    
    

    Jan

  • Hi Jan,
    Thanks for the reply. Can you point out in your posted code, which is the line/section that is setting the Wi-Fi/radio channel being used?
    -
    Thanks
    -
    Regards
    Soumyajit
  • Hi,

    Code above is for a three different TX modes (RADIO_TX_PACKETIZED, RADIO_TX_CONTINUOUS and RADIO_TX_CW). See this wiki page ( processors.wiki.ti.com/.../CC3100_&_CC3200_Radio_Tool ) to determine which mode best suits for your needs and implement this mode into your STM32 code according need.

    I think code above is simple and it is pretty obvious how works.

    Jan