Skip to content

Commit

Permalink
add stm wifi check for 3.5.2.7 (#389)
Browse files Browse the repository at this point in the history
* add stm wifi check for 3.5.2.7

Signed-off-by: Ryan Winter <[email protected]>

* update microchip link

Signed-off-by: Ryan Winter <[email protected]>

---------

Signed-off-by: Ryan Winter <[email protected]>
  • Loading branch information
ryanwinter authored Aug 4, 2023
1 parent 43260d4 commit 37ff82f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Microchip/ATSAME54-XPRO/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ For guidance on connecting additional devices, see [Getting started with IoT dev

## What you need

* The [Microchip ATSAME54-XPro](https://www.microchip.com/developmenttools/productdetails/atsame54-xpro)
* The [Microchip ATSAME54-XPro](https://www.microchip.com/development-tool/atsame54-xpro)
* USB 2.0 A male to Micro USB male cable
* Wired Ethernet access
* Ethernet cable
Expand Down
21 changes: 12 additions & 9 deletions STMicroelectronics/B-L475E-IOT01A/app/stm_networking.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ NX_PACKET_POOL nx_pool;
NX_DNS nx_dns_client;

// WiFi firmware version required
static const UINT wifi_required_version[] = {3, 5, 2, 5};
static const UINT wifi_required_version[] = {3, 5, 2, 7};

static void print_address(CHAR* preable, uint8_t address[4])
{
printf("\t%s: %d.%d.%d.%d\r\n", preable, address[0], address[1], address[2], address[3]);
}

static void check_firmware_version(CHAR* data)
static bool check_firmware_version(CHAR* data)
{
UINT status = 0;
UINT version[4];
Expand All @@ -49,21 +49,23 @@ static void check_firmware_version(CHAR* data)
if (status <= 0)
{
printf("ERROR: Unable to decode WiFi firmware\r\n");
return;
return false;
}

for (int i = 0; i < 4; ++i)
{
if (version[i] > wifi_required_version[i])
{
break;
return true;
}
else if (version[i] < wifi_required_version[i])
{
printf("ERROR: WiFi firmware is out of date\r\n");
break;
printf("ERROR: WIFI FIRMWARE IS OUTDATED, PLEASE UPDATE TO AVOID CONNECTION ISSUES\r\n");
return false;
}
}

return true;
}

static UINT wifi_init()
Expand Down Expand Up @@ -94,9 +96,10 @@ static UINT wifi_init()
WIFI_GetModuleFwRevision(data);
printf("\tFirmware revision: %s\r\n", data);

check_firmware_version(data);

printf("SUCCESS: WiFi initialized\r\n");
if (check_firmware_version(data))
{
printf("SUCCESS: WiFi initialized\r\n");
}

return NX_SUCCESS;
}
Expand Down
21 changes: 12 additions & 9 deletions STMicroelectronics/B-L4S5I-IOT01A/app/stm_networking.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ NX_PACKET_POOL nx_pool;
NX_DNS nx_dns_client;

// WiFi firmware version required
static const UINT wifi_required_version[] = {3, 5, 2, 5};
static const UINT wifi_required_version[] = {3, 5, 2, 7};

static void print_address(CHAR* preable, uint8_t address[4])
{
printf("\t%s: %d.%d.%d.%d\r\n", preable, address[0], address[1], address[2], address[3]);
}

static void check_firmware_version(CHAR* data)
static bool check_firmware_version(CHAR* data)
{
UINT status = 0;
UINT version[4];
Expand All @@ -49,21 +49,23 @@ static void check_firmware_version(CHAR* data)
if (status <= 0)
{
printf("ERROR: Unable to decode WiFi firmware\r\n");
return;
return false;
}

for (int i = 0; i < 4; ++i)
{
if (version[i] > wifi_required_version[i])
{
break;
return true;
}
else if (version[i] < wifi_required_version[i])
{
printf("ERROR: WiFi firmware is out of date\r\n");
break;
printf("ERROR: WIFI FIRMWARE IS OUTDATED, PLEASE UPDATE TO AVOID CONNECTION ISSUES\r\n");
return false;
}
}

return true;
}

static UINT wifi_init()
Expand Down Expand Up @@ -94,9 +96,10 @@ static UINT wifi_init()
WIFI_GetModuleFwRevision(data);
printf("\tFirmware revision: %s\r\n", data);

check_firmware_version(data);

printf("SUCCESS: WiFi initialized\r\n");
if (check_firmware_version(data))
{
printf("SUCCESS: WiFi initialized\r\n");
}

return NX_SUCCESS;
}
Expand Down

0 comments on commit 37ff82f

Please sign in to comment.