• AVR Freaks

Hot!MRF24WG0MA

Author
cyd
Super Member
  • Total Posts : 216
  • Reward points : 0
  • Joined: 2010/02/04 09:56:36
  • Location: Bozeman, MT
  • Status: offline
2019/06/08 16:33:10 (permalink)
0

MRF24WG0MA

I have an older design I am porting from MAL 2016 into the last harmony version supporting wifi_g_demo, v2.02b. The design is vary similiar to the wifi g demo board and therefore utilizes a pic32MX695f512H and the MRF24WG0MA module. The systems did a fine job serving up a web page for control and data display through the MAL 2016 project.
I am trying to port the wifi_g_demo of harmony v2.02b into the system but hangs up at:
SYS_Task()
    TCPIP_STACK_Task(sysObj.tcpip); 
         if(_TCPIPStackIsRunState()) 
 
// check we're getting out of Initialize procedure
    if(tcpip_stack_status == SYS_STATUS_BUSY)
    {
        uint32_t ifUpMask = 0; // masks of interfaces that are up;
        // max 32 interfaces are assumed for now!
        for(netIx = 0, pNetIf = tcpipNetIf; netIx < tcpip_stack_ctrl_data.nIfs; netIx++, pNetIf++)
        {
            if(pNetIf->Flags.bMacInitDone == 0)
            {
                return false; // not done
            }
            else if(pNetIf->Flags.bInterfaceEnabled != 0)
            {
                ifUpMask |= (1 << netIx);
            }
        }

 
tcip_stack_status = SYS_STATUS_BUSY and pNetIf->Flags.bInterfaceEnabled = 0 and therefore returns false. The wifi_reset line is toggling low at about 6.2Hz. 
 
Any ideas about why I cant get out of Initialization correctly would be appreciated.
post edited by cyd - 2019/06/08 16:36:32

Electronic Realization l.l.c.
cy@elec-real.com


#1

2 Replies Related Threads

    cyd
    Super Member
    • Total Posts : 216
    • Reward points : 0
    • Joined: 2010/02/04 09:56:36
    • Location: Bozeman, MT
    • Status: offline
    Re: MRF24WG0MA 2019/06/08 19:41:23 (permalink)
    0
    There are two systems being tested and one has a toggling wifi_reset, and the other does not. It turns out the toggling reset line is a power supply issue.

    Electronic Realization l.l.c.
    cy@elec-real.com


    #2
    cyd
    Super Member
    • Total Posts : 216
    • Reward points : 0
    • Joined: 2010/02/04 09:56:36
    • Location: Bozeman, MT
    • Status: offline
    Re: MRF24WG0MA 2019/06/10 07:04:31 (permalink)
    0
    Both systems perform similarly, but the system that resets gets a little further along, to the spot I described. The system with adequate power supply is hanging after system initialization, super loop calls SYS_Tasks(); and completes both SYS_FS_Tasks(); and  SYS_TMR_Tasks(sysObj.sysTmr); but hangs inside the function TCPIP_STACK_Task(sysObj.tcpip);.  Hanging occurs insdie the call to _TCPIPStackIsRun. While: process the underlying MAC module tasks the system hangs and will not run the following statement: BSP_LEDOn(BSP_LED_1);
     
    static bool _TCPIPStackIsRunState(void)
    {
        int netIx;
        TCPIP_NET_IF* pNetIf;

        // check that we've created the needed timer
        if(tcpip_stack_status == SYS_STATUS_BUSY && tcpip_stack_tickH == SYS_TMR_HANDLE_INVALID)
        { // check that we can create a timer
            SYS_STATUS tmrStat = SYS_TMR_ModuleStatusGet(0);
            if(tmrStat == SYS_STATUS_BUSY)
            { // not ready yet
                return false;
            }

            if(tmrStat == SYS_STATUS_READY)
            { // try to create the timer
                if(_TCPIPStackCreateTimer() == false)
                { // failed
                    tmrStat = SYS_STATUS_ERROR;
                }
            }
            
            if(tmrStat <= 0)
            { // something went wrong...
                TCPIP_STACK_KillStack();
                tcpip_stack_status = SYS_STATUS_ERROR;
                SYS_ERROR_PRINT(SYS_ERROR_ERROR, TCPIP_STACK_HDR_MESSAGE "Initialization SYS TMR failed: %d - Aborting! \n\r", tmrStat);
                return false;
            }
            
        }
        
        for(netIx = 0, pNetIf = tcpipNetIf; netIx < tcpip_stack_ctrl_data.nIfs; netIx++, pNetIf++)
        {
            
            if(pNetIf->macObjHandle != 0)
            {
                //BSP_LEDOn(BSP_LED_1);
                // process the underlying MAC module tasks
                (*pNetIf->pMacObj->TCPIP_MAC_Tasks)(pNetIf->macObjHandle);
                BSP_LEDOn(BSP_LED_1);
                // check if we're just starting up some interfaces
                if(pNetIf->Flags.bMacInitialize)
                { // initializing
                    
                    SYS_STATUS macStat = (*pNetIf->pMacObj->TCPIP_MAC_Status)(pNetIf->macObjHandle);
                    if(macStat < 0)
                    { // failed; kill the interface
                        TCPIP_STACK_BringNetDown(&tcpip_stack_ctrl_data, pNetIf, TCPIP_STACK_ACTION_IF_DOWN, TCPIP_MAC_POWER_DOWN);
                        pNetIf->Flags.bMacInitDone = true;
                    }
                    else if(macStat == SYS_STATUS_READY)
                    { // get the MAC address and MAC processing flags
                        // set the default MTU; MAC driver will override if needed
                        TCPIP_MAC_PARAMETERS macParams;
                        macParams.linkMtu = TCPIP_MAC_LINK_MTU_DEFAULT;
                        (*pNetIf->pMacObj->TCPIP_MAC_ParametersGet)(pNetIf->hIfMac, &macParams);
                        memcpy(pNetIf->netMACAddr.v, macParams.ifPhyAddress.v, sizeof(pNetIf->netMACAddr));
                        pNetIf->Flags.bMacProcessOnEvent = macParams.processFlags != TCPIP_MAC_PROCESS_FLAG_NONE;
                        pNetIf->macType = macParams.macType;
                        pNetIf->linkMtu = macParams.linkMtu;
                        // enable this interface
                        pNetIf->Flags.bInterfaceEnabled = true;
                        pNetIf->Flags.bMacInitialize = false;
                        pNetIf->Flags.bMacInitDone = true;
                    }
                }
            }
        }
        
        // check we're getting out of Initialize procedure
        if(tcpip_stack_status == SYS_STATUS_BUSY)
        {
            uint32_t ifUpMask = 0; // masks of interfaces that are up;
            // max 32 interfaces are assumed for now!
            for(netIx = 0, pNetIf = tcpipNetIf; netIx < tcpip_stack_ctrl_data.nIfs; netIx++, pNetIf++)
            {
                if(pNetIf->Flags.bMacInitDone == 0)
                {
                    return false; // not done
                }
                else if(pNetIf->Flags.bInterfaceEnabled != 0)
                {
                    ifUpMask |= (1 << netIx);
                }
            }

            // passed through all interfaces
            if(ifUpMask == ((1 << netIx) - 1))
            { // all interfaces up
                int ifNumber[TCPIP_MAC_TYPES] = { 0 };
                for(netIx = 0, pNetIf = tcpipNetIf; netIx < tcpip_stack_ctrl_data.nIfs; netIx++, pNetIf++)
                {
                    // set the interfaces name
                    strncpy(pNetIf->ifName, TCPIP_STACK_IF_ALIAS_NAME_TBL[pNetIf->macType], sizeof(pNetIf->ifName));
                    sprintf(pNetIf->ifName + strlen(pNetIf->ifName), "%d", ifNumber[pNetIf->macType]++);
                    pNetIf->ifName[sizeof(pNetIf->ifName) - 1] = 0;
                }
                tcpip_stack_status = SYS_STATUS_READY;
                SYS_CONSOLE_MESSAGE(TCPIP_STACK_HDR_MESSAGE "Initialization Ended - success \n\r");
            }
            else
            {
                // failed initializing all interfaces;
                for(netIx = 0, pNetIf = tcpipNetIf; netIx < tcpip_stack_ctrl_data.nIfs; netIx++, pNetIf++)
                {
                    if(pNetIf->Flags.bInterfaceEnabled)
                    {
                        TCPIP_STACK_BringNetDown(&tcpip_stack_ctrl_data, pNetIf, TCPIP_STACK_ACTION_IF_DOWN, TCPIP_MAC_POWER_DOWN);
                    }
                }
                tcpip_stack_status = SYS_STATUS_ERROR;
                SYS_ERROR_PRINT(SYS_ERROR_ERROR, TCPIP_STACK_HDR_MESSAGE "Initialization failed: 0x%x - Aborting! \n\r", ifUpMask);
                return false;
            }
        }

        return true;
    }

    Help is still appreciated for the firmware issue, thank you!
    post edited by cyd - 2019/06/10 09:11:00

    Electronic Realization l.l.c.
    cy@elec-real.com


    #3
    Jump to:
    © 2019 APG vNext Commercial Version 4.5