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

Long delay after begin #30

Open
metanav opened this issue Oct 28, 2024 · 19 comments
Open

Long delay after begin #30

metanav opened this issue Oct 28, 2024 · 19 comments
Assignees
Labels
enhancement New feature or request

Comments

@metanav
Copy link

metanav commented Oct 28, 2024

Why is there long delay (around 12 seconds) when Alvik.begin() called? Looking at the code it seems doing version compatibility check only. I used the code below.

import time
from arduino_alvik import ArduinoAlvik

start_time = time.time()
alvik = ArduinoAlvik()
alvik.begin()
end_time = time.time()

print(f'\nTotal time: {end_time - start_time}s')
print(f'\nlib_version: {alvik.get_lib_version()} fw_version: {alvik.get_fw_version()}')

Output:

Total time: 12s

lib_version: 1.1.0 fw_version: 1.1.0
@gbr1
Copy link
Member

gbr1 commented Oct 28, 2024

Hi @metanav !

Please can you tell me if in these 12seconds both lights are on?
Are you using stock firmware updated via alvikupdate.arduino.cc ?

Thank you in advance!

@metanav
Copy link
Author

metanav commented Oct 28, 2024

Hi @gbr1

When I click on the RUN button in the Arduino Lab for MicroPython, the right side LED (above the tick) turns on in green momentarily and turns off. After around 3 seconds, both LEDs turns on in Yellow (greenish?) for 2 seconds and turns off. I have updated the firmware by following the User manual: https://docs.arduino.cc/tutorials/alvik/user-manual/

@gbr1
Copy link
Member

gbr1 commented Oct 28, 2024

Please @metanav could you try this: https://alvikupdate.arduino.cc ?
Then turn off the robot and detach the usb cable.
See if it happens again

@metanav
Copy link
Author

metanav commented Oct 28, 2024

Now I am using the Arduino Alvik Updater as you suggested. By the way, how long does it take to complete? The status showing "Removing Folder" since 15 minutes.

Image

@gbr1
Copy link
Member

gbr1 commented Oct 28, 2024

This is very strange, it should be 2-3 minutes O_O

Which version of micropython are you using on the robot?

@metanav
Copy link
Author

metanav commented Oct 28, 2024

MicroPython v1.24.0 on 2024-10-25; Arduino Nano ESP32 with ESP32S3

@gbr1
Copy link
Member

gbr1 commented Oct 28, 2024

Ok! I need to test!

@ubidefeo could something changed?

@gbr1
Copy link
Member

gbr1 commented Oct 28, 2024

@metanav meanwhile what happens if you revert to 1.22?

@metanav
Copy link
Author

metanav commented Oct 28, 2024

I uploaded an empty sketch using the Arduino IDE to the Nano ESP32. Now the alvikupdate.arduino.cc uploaded the firmware successfully. But I do not see any improvements, it takes 9 to 15 seconds (random time) to complete the begin() call. How can I revert the Micropython firmware to 1.22?

@gbr1
Copy link
Member

gbr1 commented Oct 28, 2024

Wait, you cannot use the updater if your board isn't running micropython.
When you run an arduino sketch the flash is erased, so there isn't micropython. If you rub an Arduino sketch does it make 12s issue?

@metanav
Copy link
Author

metanav commented Oct 28, 2024

I uploaded the empty sketch again. When I connect it using the Arduino Lab for Micropython, It displays the REPL:

MicroPython v1.24.0 on 2024-10-25; Arduino Nano ESP32 with ESP32S3
Type "help()" for more information.
>>> 

It means Micropython did not remove.

@gbr1
Copy link
Member

gbr1 commented Oct 28, 2024

it could corrupted because part of the flash is overwritten

@metanav
Copy link
Author

metanav commented Oct 28, 2024

I erased the flash using the command:

esptool.py --chip esp32s3 --port /dev/tty.usbmodem142101   --baud 115200 erase_flash

Now Arduino Lab for Micropython cannot connect to it. So Micropython has gone. Let me know how to upload 1.22.

@gbr1
Copy link
Member

gbr1 commented Oct 28, 2024

Please check here:
https://micropython.org/download/ARDUINO_NANO_ESP32/
download with 1.22.2 and use Micropython Installer

@metanav
Copy link
Author

metanav commented Oct 28, 2024

I could revert it to 1.22.2 and uploaded the firmware using the alvikupdate.arduino.cc. Now it takes 6 seconds (seems consistent) to begin. Is it normal?

>>> 
MicroPython v1.22.2 on 2024-02-22; Arduino Nano ESP32 with ESP32S3
Type "help()" for more information.
>>> 
raw REPL; CTRL-B to exit
                  
Total time: 6s

lib_version: 1.1.0 fw_version: 1.1.0

@gbr1
Copy link
Member

gbr1 commented Oct 28, 2024

Yes! 6s is the normal time to boot.
It seems to be long but consider this:

1. begin() reset the stm32 on the alvik carrier
2. stm32 initialize sensors (tof require between 1.5s-2s to be ready)
3. wait for ack and version
4. check version

I'm trying to install micropython 1.24 to see what happens

@metanav thank you for debugging together

@metanav
Copy link
Author

metanav commented Oct 28, 2024

Great! Thanks, @gbr1!

@gbr1
Copy link
Member

gbr1 commented Oct 28, 2024

You are right, 1.24 introced something which makes alvik very slow

@gbr1 gbr1 assigned gbr1 and eigen-value and unassigned gbr1 Oct 28, 2024
@gbr1
Copy link
Member

gbr1 commented Oct 28, 2024

@eigen-value @ubidefeo we must do an investigation on 1.24

@gbr1 gbr1 added the enhancement New feature or request label Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants