Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firmware update #7

Closed
pdbayes opened this issue Jul 26, 2022 · 39 comments
Closed

Firmware update #7

pdbayes opened this issue Jul 26, 2022 · 39 comments

Comments

@pdbayes
Copy link

pdbayes commented Jul 26, 2022

I have 2 of these boards and am trying to update the firmware as AWS IoT Core is not recognising any of the messages sent from the demo Arduino sketch, even though I can see it is connected and sending messages. IoT Core can see it connect and auto subscribes it to some topics. I have tried to update several times and it always times out. I am connecting directly to the board via the micro usb and it is detached from the Arduino, is this correct way to do it?

@dhavalgujar
Copy link
Collaborator

Hi @pdbayes, this is not the correct way to carry out the OTW update.
You can use the microUSB port to power the board and view the ExpressLink console logs, but the only interface for sending and receiving commands is using the RX/TX pins on the board and connecting it to a host machine.

Please refer to Section 3.6.3 for making these connections.
Note that you will need to use a USB-TTL converter like the one shown in User Provided items in order to connect the ExpressLink board to your computer and issue AT commands / carry out OTW update.

Please post some logs here for the issues that you are facing with sending messages to AWS IoT Core.
Hopefully updating to the latest release will help alleviate those problems.

@pdbayes
Copy link
Author

pdbayes commented Jul 31, 2022

Thanks for responding, I have been going mad with this
OK. So I connect the board to my Arduino. I'm guessing the Arduino needs to be running just the software serial sketch and nothing else? I use my usb to TTL converter and connect to which Rx/tx on the Espressif board? And run the OTW.py on my pc with the port of usb to TTL converter and baud rate as args. Is this correct.

@dhavalgujar
Copy link
Collaborator

dhavalgujar commented Jul 31, 2022

The Arduino sketch has been provided only as a reference to quickly evaluate the ExpressLink DevKit or as a starting point for host-side code if you plan to use an Arduino as a host with ExpressLink.

You can connect the USB-TTL converter to these RX/TX pins:
el_front
You will not need to set baud rate manually, the otw.py script takes care of that while carrying out OTW update.
Please test if AT commands work using a terminal application before running otw.py

@pdbayes
Copy link
Author

pdbayes commented Jul 31, 2022

OK. Thanks. I understand the Arduino sketch is just a starter example. But I will need the software serial running to communicate won't I?

@dhavalgujar
Copy link
Collaborator

dhavalgujar commented Jul 31, 2022

Yes, you will need to use a terminal application configured with the settings from Section 3.7 in order to test if AT commands are working.

The otw.py script uses the pySerial module to communicate with ExpressLink, so you need not configure anything for that.
You will need to pip install it before running the OTW script, as shown in Section 9.2.

@pdbayes
Copy link
Author

pdbayes commented Aug 1, 2022

Should this work with an Arduino Uno? It only has one UART. Software serial just seems to duplicate pins 1 and 0 which are the same uart the dev board is using

@dhavalgujar
Copy link
Collaborator

dhavalgujar commented Aug 1, 2022

Yes, you can use ExpressLink with an Arduino Uno.
You can use pins 8 and 9 of the Arduino as shown in Section 8.1 to get a different software serial.
Of course, for this you will need to connect a USB-TTL dongle to those pins.

@pdbayes
Copy link
Author

pdbayes commented Aug 1, 2022

I am trying that and I get no response from AT commands

@dhavalgujar
Copy link
Collaborator

dhavalgujar commented Aug 1, 2022

Are you trying to use the Arduino Uno as a pass-through serial interface?

Do the AT commands work for you when you try with a USB-TTL dongle and connect to the RX/TX pins of the ExpressLink board directly (and use a desktop terminal application)?

@pdbayes
Copy link
Author

pdbayes commented Aug 1, 2022

I have tried as a passthrough device and also using the sketch provided.
which pins are direct connections, are they the ones in the image above? And should it be disconnected from the Arduino for this to work?

@pdbayes
Copy link
Author

pdbayes commented Aug 1, 2022

I have a serial connection as pressing the reset button gives be a lot of info ending in this;
I (935) ExpressLink: Thingname is: bd244628-8223-42e9-85d2-fc55383371de

[INFO] [TE] [thirdeye_init:87] Starting ThirdEye

I (945) gpio: GPIO[10]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldo wn: 0| Intr:0

I (955) gpio: GPIO[4]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldow n: 1| Intr:0

I (965) gpio: GPIO[5]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldow n: 1| Intr:0

[INFO] [TE] [thirdeye_init:123] Starting MQTT Agent

[INFO] [MQMGR] [bStartMQTTAgent:314] MQTT Agent started successfully

I (985) TIME: Initializing the NTP

[INFO] [APPMAIN] [app_main:125] [INIT] Complete.

[INFO] [APPMAIN] [app_main:130] APP_MAIN complete

I (985) OTA: Current Firmware version 0.9.3

I (995) OTA: Waiting for MQTT agent to be connected.

@pdbayes
Copy link
Author

pdbayes commented Aug 1, 2022

Swapping RX and TX seems to now give me a response

@pdbayes
Copy link
Author

pdbayes commented Aug 1, 2022

So, I still can't update the firmware. What needs to be running on the UNO?

@pdbayes
Copy link
Author

pdbayes commented Aug 1, 2022

And sent messages to AWS are not showing in the MQQT test window

@dhavalgujar
Copy link
Collaborator

dhavalgujar commented Aug 1, 2022

So, I still can't update the firmware. What needs to be running on the UNO?

For OTW, please connect to your computer directly using a USB-TTL dongle and run the script, please disconnect it from Arduino during OTW.

And sent messages to AWS are not showing in the MQQT test window

Can you please post logs from both consoles? (ExpressLink logs which are viewable using the microUSB and also the console where you issued AT commands)

@pdbayes
Copy link
Author

pdbayes commented Aug 1, 2022

I will do this later. I have to do my work for most of the day. It did start the firmware update but failed reading the version number.

@pdbayes
Copy link
Author

pdbayes commented Aug 2, 2022

It is all working now, thanks for your help. One thing I did notice, when I typed AT+CONF EndPoint=abcdef I got an error, I had to change it to Endpoint. The example sketch is using EndPoint.

@mra59
Copy link

mra59 commented Aug 4, 2022

Hi pdbayes, I'm using the same devkit but I cannot connect to AWS: could you tell me what is the firmware revision you have installed into the devkit using the OTW procedure?
Many thanks

@pdbayes
Copy link
Author

pdbayes commented Aug 4, 2022

It was originally something like 0.9.60. My issue in updating was that you need to cross the Rx and TX of the TTL converter.
Also in the example code there is possibly an error on the setting the endpoint. It should be Endpoint with no capital P. I provisioned mine manually using the USB ttl converter and it was fine after that.

@mra59
Copy link

mra59 commented Aug 4, 2022

Me too discovered the "Endpoint" string and received the DevKit with an old revision.
Using the OTW I flashed that I think is the last revision: v1.0.20.bin.
I have also properly connected the DevKit to my PC (I use Realterm to send commands) using an USB-to-UART converter and the communication is ok.
I get the "OK" answer to the AT Commands that I send but my issue is that it cannot connect to AWS.
I receive the error message "ERR14 4 UNABLE TO CONNECT Failed to securely authenticate with AWS" just 2 o3 seconds after the AT+CONNECT command.
I properly set the device object in AWS (I have already used the IoT Core with other boards) but I don't have any idea about the reason of the ERR14.
Any advice?

@pdbayes
Copy link
Author

pdbayes commented Aug 4, 2022

Did you copy and upload the certificate from the device and called the thing the same as the board reports as it's thing name?

@mra59
Copy link

mra59 commented Aug 4, 2022

Yes: first I downloaded the Certificate from DevKit (AT+CONF? Certificate), then its Thing name (AT+CONF? ThingName).
Then I created in my AWS IoT Core account the object with the ThingName and I created a Policy allowing all operations from any arn.
Then I attaced the certificate (activated) to the policy and I obtained the endpoint from AWS (1234567890.iot.eu-west-1.amazonaws.com)
This endpoint was transferred to the Devkit with the AT+CONF Endpoint=1234567890.iot.eu-west-1.amazonaws.com.
Now I'm ready to connect but I always receive the "ERR14 4 ......" message.
I checked the WiFi access point and I can see the "espressif" connected with its IP address and MAC.
The connection time is only 6 seconds!!!!!!!

@dhavalgujar
Copy link
Collaborator

dhavalgujar commented Aug 4, 2022

Hi @mra59, can you post the logs that you are seeing on the ExpressLink console i.e. UART0 (from the microUSB port) on your original issue #8?

@mra59
Copy link

mra59 commented Aug 4, 2022

Hi dhavalgujar, I tried two ways: the first is connecting the DevKit to my PC through a USB-to-UART converter.
I connected Rx and tx lines to the Arduino pins 0 and 1 so that I can manually send commands using the RealTerm software.
In this way I receive the famous "ERR14 4 ...." errore message.
The second way I tried was the use of the "Start_Quick_Connect" software: in this case I connected my PC directly to the Micro USB port of the Devkit.
Before running the "Start_Quick_Connect" I setup the serial port, the SSID and the Passphrase in the "Config.txt" file used by the "Start_Quick_Connect" software.
Despite this the "Start_Quick_Connect" ask me to insert all the parameters needed to connect: SSID, Passphrase, ThingName and Endpoint: I answered to these questions manually using the RealTerm connected with the USB-to_UART Converter to the Arduino Rx and tx pins.
After finishing I get a little different error that is "Thing doesn't exist" (see the attached report).
To resume: sending manually AT+CONNECT I get the message "ERR14 4 UNABLE TO CONNECT Failed to securely authenticate with AWS", using the QuickConnect software I get the "Status Code 400, (Thing doesn't exist)"

Connection_Error_StatusCode_400.pdf

@mra59
Copy link

mra59 commented Aug 4, 2022

I attach again the last part of the log of the "Start Quick Connect" software because the previous one was not complete.
Connection_Error_StatusCode_400.pdf

@mra59
Copy link

mra59 commented Aug 4, 2022

Maybe the reason could be that my AWS account is registered in Ireland (eu-west-1) and the Devkit object/certificate is valid only in other regions (pacific ap-east-1 or ap-south-1) ?

@dhavalgujar
Copy link
Collaborator

@mra59 Thank you for sending these logs.
Can you also send the logs from the serial port that you get when you connect the ExpressLink to your computer via microUSB?
When you reset the board you will see the bootup log on this port.
That will help us investigate the issue that you are facing.

There is no region restriction for using ExpressLink devkits.

@mra59
Copy link

mra59 commented Aug 4, 2022

This is the log at DevKit startup.
ESP32_C3_MINI-1-AWS_ExpressLink_StartupMessage_20220804.txt

@dhavalgujar
Copy link
Collaborator

Bootup looks okay, you've successfully updated to v1.0.20 of the firmware.

Can you see what logs you get on this console, when you try to use the AT+CONNECT command?

The log will contain your SSID and Passphrase, please redact them before posting the log here.

@mra59
Copy link

mra59 commented Aug 4, 2022

Attached the log of the 3 commands.
The DevKit is properly connected to my WiFi network (I'm using my smartphone as Access Point in this moment) because I see that it's registered as "espressif" with its IP address and its MAC number.
ERR14_Log_20220804.txt

@dhavalgujar
Copy link
Collaborator

When you run these commands, you'll also see corresponding debug logs on the console where you could see the bootup log.
Basically you need to simultaneously open two consoles, one where you will give the AT command and the other where you can see what the module is doing.

We should be able to better diagnose your issue if we can look at those logs.
Does this make sense?

@mra59
Copy link

mra59 commented Aug 4, 2022

Nice idea.
I opened two istances of the RealTerm, one to manually send the AT+CONNECT command and the second istance connected to the DevKit USB port.
Attached the Log of the USB port.
ESP32-C3_USB_Port_Connection_Log.txt

@dhavalgujar
Copy link
Collaborator

Your endpoint seems to be incorrect, can you try setting it again using the AT+CONF Endpoint=<endpoint> command?

@mra59
Copy link

mra59 commented Aug 4, 2022

@mra59
Copy link

mra59 commented Aug 4, 2022

I attach a screenshot of the object and its endpoint I created in my AWS account.
AWS_Object

@dhavalgujar
Copy link
Collaborator

dhavalgujar commented Aug 4, 2022

You seem to be confusing the ARN of your Thing, i.e. arn:aws:iot:eu-west-1:880869895289:thing/724bc322-581a-4ed7-8d1d-ca3aa31f88e5 with the Endpoint of your AWS account. :)
The endpoint would resemble something like: abcd1234-ats.iot.eu-west-1.amazonaws.com

You can find yours on the Settings page.

I believe you were setting it correctly earlier, when you said:

I obtained the endpoint from AWS (1234567890.iot.eu-west-1.amazonaws.com) This endpoint was transferred to the Devkit with the AT+CONF Endpoint=1234567890.iot.eu-west-1.amazonaws.com.

@mra59
Copy link

mra59 commented Aug 4, 2022

I set AT+CONF Endpoint=agg23zwk76whx-ats.iot.eu-west-1.amazonaws.com and now it works!!!
I'm very grateful to you but I'm very sure that I tried also this Endpoint value during all the tests I performed to let the Devkit working.
Anyway I thank you very much also for the advice to use the USB port as logger of what happen inside.
Many thanks

@dhavalgujar
Copy link
Collaborator

Glad it worked out for you, @mra59!


@pdbayes, the sketch will be updated shortly with a few fixes to the serial read logic and like you mentioned, the updated AT commands.
Since the issue you reported originally is resolved, I will close this one.
Feel free to open a new issue in case you run into any other problems.

@geb212
Copy link

geb212 commented Jun 1, 2023

@dhavalgujar

image

Hi, for me these pin doesn't work, I use the pin gnd, tx and x of the ack con the board, ait's worked, but I can't uate the firmware, what I have to do?
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants