This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:iot-open:practical:hardware:sut:stm32:iot_at [2024/04/25 10:37] – [Result validation] ktokarz | en:iot-open:practical:hardware:sut:stm32:iot_at [2024/04/27 08:14] (current) – [Result validation] ktokarz | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== STM_IoT_AT: | + | ====== STM_IoT_AT: |
The STM32WB55 SoC doesn' | The STM32WB55 SoC doesn' | ||
Line 58: | Line 58: | ||
lcd.begin(16, | lcd.begin(16, | ||
</ | </ | ||
- | And set the two strings : | + | And set the two strings |
<code c> | <code c> | ||
compOK = " | compOK = " | ||
Line 65: | Line 65: | ||
=== Step 4 === | === Step 4 === | ||
- | The AT commands are sent via a serial port connected to the ESP32-C3 module. At the beginning, we can send an empty command | + | The AT commands are sent via a serial port connected to the ESP32-C3 module. At the beginning, we can send an empty command |
<code c> | <code c> | ||
+ | // Display the message that the software has started | ||
lcd.setCursor(0, | lcd.setCursor(0, | ||
lcd.print(" | lcd.print(" | ||
delay(1000); | delay(1000); | ||
- | WiFiSerial.println(" | + | // Send the " |
- | do{ | + | WiFiSerial.println(" |
- | // Wait until 0x0A (Line Feed) character | + | |
- | response = WiFiSerial.readStringUntil(0x0A); | + | // Display |
- | // Check if the response | + | lcd.setCursor(0, |
- | if (response.startsWith(compERROR)) | + | lcd.print(" |
- | { | + | do { |
- | | + | |
- | lcd.println("Error at x"); // Message when ERROR came | + | |
- | } | + | response = WiFiSerial.readStringUntil(0x0A); |
- | } | + | |
- | // Stay in the loop until the response is " | + | |
- | while (!(response.startsWith(compOK))); | + | lcd.setCursor(0, |
- | lcd.setCursor(0, | + | lcd.print(response); |
- | lcd.println(" | + | |
+ | // Repeat | ||
+ | } while (!(response.startsWith(compOK))); | ||
</ | </ | ||
- | In the final code change '' | + | This code allows us to observe what AT command has been sent and all the responses. It waits until the " |
+ | < | ||
+ | You can use this part of the code in the following scenarios for every AT command to observe their behaviour and easily debug possible errors. | ||
+ | </ | ||
==== Result validation ==== | ==== Result validation ==== | ||
- | You should be able to see the information '' | + | You should be able to see the " |
+ | <note info> | ||
+ | Because LCD can't properly display some non-visible characters the presented code sometimes shows additional, non-letter characters. It is out of the scope of this scenario to filter these characters out. We leave the task of making visual improvements to your invention. | ||
+ | </ | ||
===== FAQ ===== | ===== FAQ ===== | ||
- | **Can I change MAC?**: Actually, yes, you can. It is not advised, however, because you may accidentally generate an overlapping address that will collide | + | **Do I need to write the program for the WiFi module?** No you don't have to. The ESP32-C3 module |
- | <code c> | + | **Can I use a similar WiFi module in my own IoT projects?** Certainly! The universal serial port connects the module so the module can be used with almost every microcontroller as the WiFi network controller.\\ |
- | #include <WiFi.h> | + | **Are AT commands the same for all modules available? |
- | #include < | + | |
- | + | ||
- | uint8_t newMAC[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xCA, 0xFE}; //Array of bytes with new MAC | + | |
- | void setup() | + | |
- | { | + | |
- | | + | |
- | | + | |
- | } | + | |
- | </ | + | |
<WRAP noprint> | <WRAP noprint> |