3.1.2.1 Execution

Initialize the ATWINC15x0/ATWINC3400 and retrieve information.

  1. Code summary:
    • The MAC address is typically stored in the OTP-ROM. You can get it via the m2m_wifi_get_otp_mac_address() function.
      /* Get MAC Address from OTP. */
      	m2m_wifi_get_otp_mac_address(mac_addr, &u8IsMacAddrValid);
    • To set the user defined MAC address in the program memory, the m2m_wifi_set_mac_address() function is used. This API needs to be called whenever the system resets. This API overwrites the program memory MAC address, which is loaded from the OTP memory during the initialization process.
      /** User defined MAC Address. */
              const char main_user_defined_mac_address[] = {0xf8, 0xf0, 0x05, 0x20, 0x0b, 0x09};
             /* Cannot find MAC Address from OTP. Set user defined MAC address. */
      	m2m_wifi_set_mac_address((uint8_t *)main_user_defined_mac_address);
    • The API m2m_wifi_get_mac_address() is used to read the program memory MAC address. It is currently used by the WLAN device.
      /* Get MAC Address. */
      	m2m_wifi_get_mac_address(mac_addr);
      	printf("%02X:%02X:%02X:%02X:%02X:%02X\r\n",
      			mac_addr[0], mac_addr[1], mac_addr[2],
      			mac_addr[3], mac_addr[4], mac_addr[5]);
  2. Build the program and download it into the board.
  3. Start the application.