2.2 Firmware

From Advanced Software Framework (ASF) 3.51, do all the measurements with example applications. The following is the list of applications used for each of the Mi-Wi network topology:

For Mi-Wi Mesh, Mi-Wi Mesh secured end device WSN demo application – SAM R30 is used.

The following is the list of modifications from the default application:
  1. The transmit power of the SAM R30 is set at the maximum level for the North American band. This is done in the phyInit() method of the phy.c file. The following is the modified line of code:
    phyWriteRegister(PHY_TX_PWR_REG, 0xC0);
  2. Modify the parameter, APP_SENDING_INTERVAL, in the config.h file to configure the payload application data transmission interval to 90 seconds.
    #define APP_SENDING_INTERVAL 90000
  3. Modify the parameter, DATA_REQUEST_SEND_INTERVAL, in the miwi_config_mesh.h file to configure the periodic polling data request interval to 20 seconds.
    #define DATA_REQUEST_SEND_INTERVAL 20
  4. APP_CAPTION is updated to value Client-End Device1234567891234 in the config.h file to ensure the application payload size is equal to 80 bytes (maximum).
    #define APP_CAPTION "Client-End Device1234567891234"

For Mi-Wi P2P, Mi-Wi P2P simple example application – SAM R30 is used.

The following is the list of modifications from the default application:

  1. ENABLE_SLEEP_FEATURE is added as a symbol in the Toolchain configuration (Atmel Studio>Project>Properties>Toolchain>ARM/GNU C Compiler>Symbols).
  2. Disable ENABLE_CONSOLE in the miwi_config.h file.
    //#define ENABLE_CONSOLE
  3. For the profiling scenario to transmit data to a peer device with maximum payload, in p2p_demo.c file, the run_p2p_demo() method is modified. The following code provides details about the modification of some specific lines in the code:
    uint8_t PressedButton = ButtonPressed();
    switch( PressedButton ){         
    case 1:
    {
    /*******************************************************************/
    // Button 1 pressed. We need to send out the bitmap of word "MiWi". 
    /*******************************************************************/ 
    uint16_t broadcastAddress = 0xFFFF;
    
    bool mac_ack_status;
    
    uint8_t payload[76]={0xB2,0xB2,0xB2,0x20,0x20,0xB2,0xB2,0xB2,0xB2,0x0D,0xB2,0xB2,0xB2,0x20,0x20,0xB2,0xB2,0xB2,0xB2,0x0D,0xB2,0xB2,0xB2,0x20,0x20,0xB2,0xB2,0xB2,0xB2,0x0D,0xB2,0xB2,0xB2,0x20,0x20,0xB2,0xB2,0xB2,0xB2,0x0D,0xB2,0xB2,0xB2,0x20,0x20,0xB2,0xB2,0xB2,0xB2,0x0D,0xB2,0xB2,0xB2,0x20,0x20,0xB2,0xB2,0xB2,0xB2,0x0D,0xB2,0xB2,0xB2,0x20,0x20,0xB2,0xB2,0xB2,0xB2,0x0D,0xB2,0x20,0x20,0xB2,0xB2,0xB2};
    
    mac_ack_status = MiApp_SendData(SHORT_ADDR_LEN, (uint8_t *)&broadcastAddress, 76, (uint8_t *)payload, msghandledemo++, true, dataConfcb);
    
    if (mac_ack_status)
    {
    /* Update the bitmap count */
    TxSynCount++;
    }
    }            
    } 
    break;
  4. The transmit power of the SAM R30 is set at the maximum level for the North American band. This is done in the phyInit() method of the phy.c file. The following is the modified line of code:
    phyWriteRegister(PHY_TX_PWR_REG, 0xC0);
  5. The following lines of code are commented out in file task.c under the method Connection_confirm(). The user must do this to avoid a hardfault, as the Universal Asynchronous Receiver/Transmitter (UART) cannot be initialized due to undefining of the ENABLE_CONSOLE build switch for optimized power consumption.
    //    printf("\r\nStarted Wireless Communication on Channel ");
    //    printf("%u",currentChannel);
    //    printf("\r\n");

For Mi-Wi Star, Mi-Wi Star simple example application – SAM R30 is used.

The following is the list of modifications from the default application:
  1. Add ENABLE_SLEEP_FEATURE as a symbol in the Toolchain configuration (Atmel Studio>Project>Properties>Toolchain>ARM/GNU C Compiler>Symbols).
  2. For the profiling scenario to transmit data to the Personal Area Network (PAN) coordinator and another Energy Detection (ED) on the same network, in star_demo.c, arguments to MiApp_SendData are edited as indicated below:
    For sending data to the PAN coordinator.
    if(switch_val == 1)
    {
    update_ed = false;   // No Display of peer Device Info 
    chk_sel_status = false;   // Selection Mode off
    
    if (myConnectionIndex_in_PanCo == select_ed)
    {
    
    uint8_t payload[76]={0xB2,0xB2,0xB2,0x20,0x20,0xB2,0xB2,0xB2,0xB2,0x0D,0xB2,0xB2,0xB2,0x20,0x20,0xB2,0xB2,0xB2,0xB2,0x0D,0xB2,0xB2,0xB2,0x20,0x20,0xB2,0xB2,0xB2,0xB2,0x0D,0xB2,0xB2,0xB2,0x20,0x20,0xB2,0xB2,0xB2,0xB2,0x0D,0xB2,0xB2,0xB2,0x20,0x20,0xB2,0xB2,0xB2,0xB2,0x0D,0xB2,0xB2,0xB2,0x20,0x20,0xB2,0xB2,0xB2,0xB2,0x0D,0xB2,0xB2,0xB2,0x20,0x20,0xB2,0xB2,0xB2,0xB2,0x0D,0xB2,0x20,0x20,0xB2,0xB2,0xB2};
    
    /* IF on the demo , a END_Device displays its own Connection Detailunicast data packet to just PAN COR , No forwarding */
    mac_ack_status = MiApp_SendData(LONG_ADDR_LEN, connectionTable[0].Address, 76, (uint8_t*)payload, msghandledemo++, true, dataConfcb);
    
    if (mac_ack_status)
    {
    TxSynCount++;
    }
    }
    }
    For sending data to another ED in the same network.
    if(switch_val == 1)
    {
    update_ed = false;    // No Display of peer Device Info
    chk_sel_status = false;   // Selection Mode off
    
    if (myConnectionIndex_in_PanCo == select_ed)
    {
    
    uint8_t payload[76]={0xB2,0xB2,0xB2,0x20,0x20,0xB2,0xB2,0xB2,0xB2,0x0D,0xB2,0xB2,0xB2,0x20,0x20,0xB2,0xB2,0xB2,0xB2,0x0D,0xB2,0xB2,0xB2,0x20,0x20,0xB2,0xB2,0xB2,0xB2,0x0D,0xB2,0xB2,0xB2,0x20,0x20,0xB2,0xB2,0xB2,0xB2,0x0D,0xB2,0xB2,0xB2,0x20,0x20,0xB2,0xB2,0xB2,0xB2,0x0D,0xB2,0xB2,0xB2,0x20,0x20,0xB2,0xB2,0xB2,0xB2,0x0D,0xB2,0xB2,0xB2,0x20,0x20,0xB2,0xB2,0xB2,0xB2,0x0D,0xB2,0x20,0x20,0xB2,0xB2,0xB2};
    select_ed = 1;
    
    mac_ack_status = MiApp_SendData(3, END_DEVICES_Short_Address[select_ed].Address,76, (uint8_t*)payload, msghandledemo++, true, dataConfcb);
    
    if (mac_ack_status)
    {
    TxSynCount++;
    }
    }
    }
    Here the assumption is that the other ED has a connection index of 1. The user can do this by first joining the Device Under Test (DUT) as the ED to PAN coordinator followed by the other ED.
  3. The transmit power of the SAM R30 is set at the maximum level for the North American band. This is done in the phyInit() method of the phy.c file. The following is the modified line of code:
    phyWriteRegister(PHY_TX_PWR_REG, 0xC0);
  4. Disable ENABLE_CONSOLE in the miwi_config.h file.
    //#define ENABLE_CONSOLE
  5. For optimizing the sleep current consumption in the end device, comment out the method call sio2host_init() in main.c to skip the initialization of the serial port.
    //sio2host_init();
  6. Surround the method DemoOutput_Channel() in demo_output.c with #if defined(ENABLE_CONSOLE) as illustrated below:
    void DemoOutput_Channel(uint8_t channel, uint8_t Step)
    {
    #if defined(ENABLE_CONSOLE)
    if( Step == 0 )
    {
    #if defined (ENABLE_LCD)
    LCDDisplay((char *)"Connecting Peer on \n Channel ", channel, true);
    #endif
    #if !defined(MIWIKIT)
    printf("\r\nConnecting Peer on Channel "); 
    printf("%d",channel);
    printf("\r\n");
    #endif 
    } else
    {
    #if defined (ENABLE_LCD)
    LCDDisplay((char *)"Connected Peer on \n Channel ", channel, true);
    #endif
    #if !defined(MIWIKIT)
    printf("\r\nConnected Peer on Channel "); 
    printf("%d",channel);
    printf("\r\n");
    #endif 
    }
    #endif 
    }