Skip to content

Franzininho WiFi Board (ESP32-S2) #196

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

Closed
arcostasi opened this issue Sep 28, 2021 · 60 comments
Closed

Franzininho WiFi Board (ESP32-S2) #196

arcostasi opened this issue Sep 28, 2021 · 60 comments
Labels
open for vote Vote at https://wokwi.com/features

Comments

@arcostasi
Copy link

Franzininho WiFi Board is a development board to evaluate ESP32-S2 Modules (Wroom and Wrover) and develop the new generation of Franzininho Boards. The Franzininho project was created to develop skills in people in the areas of electronics and programming, through activities in the DIY format and in conjunction with maker culture in Brazil.

Project: https://github.com/Franzininho/Franzininho-WIFI

The project is an open-source hardware and is available on CERN open hardware license.

The Franzininho WiFi board is certified in OSHWA: UID BR000006

@urish urish added the open for vote Vote at https://wokwi.com/features label Sep 28, 2021
@urish
Copy link
Contributor

urish commented Sep 29, 2021

Great to see this racing to the top of the feature list!

Preparing the data for the board design:

Is there any publicly available SVG drawing of the board?

AriellaE added a commit to wokwi/wokwi-boards that referenced this issue Oct 3, 2021
@urish
Copy link
Contributor

urish commented Oct 5, 2021

Initial version of the board is now available in wokwi/wokwi-boards.

You can go ahead and load it in the simulator by following the instructions for loading a custom board.

You'll be able to preview the board and draw connections, but the simulation does not work yet:

  1. The build will fail due to Can't install v2.0.0 on arm64 espressif/arduino-esp32#5735
  2. The ESP32-S2 chip simulation is still WiP

@arcostasi
Copy link
Author

Thanks Uri, any results with the armel toolchain mentioned in espressif/arduino-esp32#5735 (comment)

@arcostasi
Copy link
Author

Is there any publicly available SVG drawing of the board?

Sorry I didn't see the question, but we love the svg created by Ariella.

@urish
Copy link
Contributor

urish commented Oct 8, 2021

Thanks Uri, any results with the armel toolchain mentioned in espressif/arduino-esp32#5735 (comment)

Yes, positive results! I just added a comment there

@urish
Copy link
Contributor

urish commented Oct 9, 2021

Some more updates: working to get the ESP32-S2 simulator to a usable state, then integrate it with Wokwi.

So far, was able to get MicroPython 1.17 prompt:

$ npx ts-node demo/micropython

MicroPython v1.17-74-gd42cba0d2-dirty on 2021-10-09; ESP32S2 module with ESP32S2
Type "help()" for more information.
>>> print("Hello, world!", 3**6)
Hello, world! 729
>>> import time
>>> time.ticks_ms()
945648215
>>> 

So this is a good sign. It means that the following peripherals are working correctly:

  • CPU core
  • UART
  • Flash access (otherwise MicroPython fails to start with FS initialization errors)
  • System timer (partially - we shouldn't get a ticks_ms() value this large when we just started)

There's still much work to do before it'll be usable:

  • USB (as Franzininho WiFi uses USB over UART)
  • GPIO (so we can eventually see the LED blinking!)
  • Fix the timers (so delay() works reliably)

And probably a bunch of other things we'll discover along the way :-)

@arcostasi
Copy link
Author

What great news Uri, there really is a lot of work to be done! If you need, I can go testing and validating with Franzininho WiFi hardware. Very good to know about was able to get MicroPython, Franzininho WiFi now has official support for CircuitPython, I believe we will explore this feature a lot. :-)

@urish
Copy link
Contributor

urish commented Oct 9, 2021

Excellent! CircuitPython will probably be another stage, first let's get the Arduino stuff to work!

@urish
Copy link
Contributor

urish commented Oct 14, 2021

Progress update: GPIO is functional!

So as soon as the Arduino-ESP32 issue will be resolved, we'll be able to close the loop and have Blink working.

I'm now starting to work on USB, which will enable CircuitPython (as well as easier output from the Arduino Core).

@urish
Copy link
Contributor

urish commented Oct 17, 2021

Video showing CircuitPython work-in-progress: https://twitter.com/WokwiMakes/status/1449804926478168068

@urish
Copy link
Contributor

urish commented Oct 27, 2021

Now you can try it yourself!

Find the complete instructions here: https://wokwi.com/arduino/projects/313606939786347074

@urish
Copy link
Contributor

urish commented Oct 27, 2021

Update: NeoPixel also works now!

To try, paste the following code in the CircuitPython REPL:

import board
import neopixel_write
import digitalio

pin = digitalio.DigitalInOut(board.NEOPIXEL)
pin.direction = digitalio.Direction.OUTPUT
green = bytearray([255, 0, 0])
neopixel_write.neopixel_write(pin, green)

@urish
Copy link
Contributor

urish commented Oct 31, 2021

Update: you can now run the Franzininho WiFi CircuitPython Demo Project out of the box, without any special instructions.

I hope the Arduino Core issue gets fixed soon, and so we'll also have a set of demos with Arduino.

@arcostasi
Copy link
Author

arcostasi commented Nov 2, 2021

Very good, doing some tests with CircuitPython, a question, is time.sleep already implemented?

This is the code I'm testing:

""" Hello, World! (Blink LED)"""
import board
import time
from digitalio import DigitalInOut, Direction

# Setting the LED pin, the LED I configured was pin 4 = IO4
led = DigitalInOut(board.IO4)
led.direction = Direction.OUTPUT

# infinite loop - always running
while True:    
    led.value = True
    time.sleep(0.5)
    led.value = False
    time.sleep(0.5)

Diagram link: https://wokwi.com/arduino/projects/314165931402068544

@FBSeletronica
Copy link

FBSeletronica commented Nov 2, 2021

Very good, doing some tests with CircuitPython, a question, is time.sleep already implemented?

This is the code I'm testing:

""" Hello, World! (Blink LED)"""
import board
import time
from digitalio import DigitalInOut, Direction

# Setting the LED pin, the LED I configured was pin 4 = IO4
led = DigitalInOut(board.IO4)
led.direction = Direction.OUTPUT

# infinite loop - always running
while True:    
    led.value = True
    time.sleep(0.5)
    led.value = False
    time.sleep(0.5)

Diagram link: https://wokwi.com/arduino/projects/314165931402068544

I had the same problem here:
image

The led is always ON

@urish
Copy link
Contributor

urish commented Nov 2, 2021

Yes, it seems like the internal timer is going way too fast, so the sleep finishes immediately. I'll try to figure out why this happens

@urish
Copy link
Contributor

urish commented Nov 4, 2021

Sleep fixed!

@urish
Copy link
Contributor

urish commented Nov 4, 2021

Progress update: Filesystem works!

You can try it here: https://wokwi.com/arduino/projects/313606939786347074

Note that the code still doesn't run automatically (CP starts in Safe mode, I still have to figure out how to avoid this), so you have to manually load it from the REPL:

import code

@urish
Copy link
Contributor

urish commented Nov 10, 2021

espressif/arduino-esp32#5735 fixed! Meaning you can now enjoy:

There's still some issue with the USB Serial output on Arduino Core, I have to debug it and figure out why it doesn't print any output. But other than that, it's pretty usable :)

@arcostasi
Copy link
Author

Thanks Uri, good to hear that espressif fixed this! everyone is to be congratulated 😉

@urish
Copy link
Contributor

urish commented Nov 23, 2021

USB Serial on Arduino core works! Example:

https://wokwi.com/arduino/projects/316092312585241154

So the Arduino core is pretty much complete. Let's see what people build with it. Over the next few days, I'll add the Franzininho WiFi to the "new project" menu, documentation, etc. so it'll become generally available.

My next action item here is to make CircuitPython load the user code when the simulation starts.

@urish
Copy link
Contributor

urish commented Nov 23, 2021

Forgot to say - also added an automated test case for Franzininiho WiFi simulation: https://github.com/wokwi/wokwi-tests/tree/master/franzininho-wifi/usb-serial

@arcostasi
Copy link
Author

Thanks Uri, I'll share it in the community and try it out!

@urish
Copy link
Contributor

urish commented Feb 4, 2022

Some updates: I implemented a bunch of performance speedups (similar to the ones I did for the ESP32), and now the ESP32-S2 simulation runs about 4 times faster.

Getting the WiFi to work is still a big challenge - I'll keep update here as I slowly make progress.

@arcostasi
Copy link
Author

Some updates: I implemented a bunch of performance speedups (similar to the ones I did for the ESP32), and now the ESP32-S2 simulation runs about 4 times faster.

That's great Uri, it's already a huge improvement! In my tests I've already noticed the improvement in speed ;)

Getting the WiFi to work is still a big challenge - I'll keep update here as I slowly make progress.

All right, but that's already a big step forward! I'll do more tests! Thanks

@urish
Copy link
Contributor

urish commented Feb 8, 2022

Good news: the WiFi is working!

Examples:

Note: TLS support isn't there yet. We'll need to implement the crypto hardware accelerators - SHA, AES, RSA and possibly a few more before TLS/HTTPS will be functional. Similar to what we did in #267.

@arcostasi
Copy link
Author

That's great! I will share it with the community! Thanks

@urish
Copy link
Contributor

urish commented Feb 20, 2022

Progress update: HTTPS is now working on Arduino Core!

I made a quick example that fetches jokes from an online REST API and displays them on an LCD screen:

https://wokwi.com/arduino/projects/324148356078109268

I've finished the AES/SHA accelerators. Once I finish the RSA accelerator, I hope we'll also get HTTPS on CircuitPython.

@arcostasi
Copy link
Author

@urish Is it possible to send printf output to serial monitor using ESP-IDF like ESP32 devkit v1?

@urish
Copy link
Contributor

urish commented Feb 26, 2022

@arcostasi yes - but you need to adjust the connection in diagram.json to read:

    [ "esp:TX", "$serialMonitor:RX", "", [] ],
    [ "esp:RX", "$serialMonitor:TX", "", [] ],

(instead of TX0 / RX0)

@arcostasi
Copy link
Author

Thanks Uri, printf() is working perfectly! :)

@urish
Copy link
Contributor

urish commented Feb 26, 2022

Excellent!

What do you think is still missing before we can release the Franzininho WiFi board?

@arcostasi
Copy link
Author

I will do more tests today and give feedback! for now it's ok

@urish
Copy link
Contributor

urish commented Feb 26, 2022

Thank you!

From my end: need to create a documentation page, add it to the list of "New project" options, create some basic examples (perhaps we can use the examples that you created?)

Nice-to-have: Finish CircuitPython support (so it won't start in Safe mode); MicroPython support

@arcostasi
Copy link
Author

arcostasi commented Feb 26, 2022

From my end: need to create a documentation page, add it to the list of "New project" options, create some basic examples (perhaps we can use the examples that you created?)

Feel free to use my examples! I will create more examples during my tests.

Nice-to-have: Finish CircuitPython support (so it won't start in Safe mode); MicroPython support

Yes, I believe CircuitPython will be used more by the Franzininho community.

Thanks Uri

@arcostasi
Copy link
Author

@urish, I'm testing the inputs, in your example of the piano with Franzininho WiFi, when I release a key and press another the input doesn't respond, I need to press it again to hear the buzzer.

@urish
Copy link
Contributor

urish commented Feb 26, 2022

Thanks @arcostasi!

Can you connect the logic analyzer and check if the data is fed in (but not played but the speaker) or if it skips feeding in the data?

On a different note - worked on CircuitPython today. It now runs your code automatically:

https://wokwi.com/arduino/projects/313606939786347074

However, there's one annoying thing: you don't see all the output immediately, as it takes a few microseconds for the USB to connect. This means that if you have a syntax error in your code, you'll need to press "Ctrl+D" to see it.

@arcostasi
Copy link
Author

Hi @urish, apparently with the logic analyzer it's normal! I pressed 3 times alternately between the red and orange button and I did not hear the speaker, when I pressed 2 times on the same button without alternating I can hear the speaker.
logic-analyzer-

@urish
Copy link
Contributor

urish commented Feb 27, 2022

Thanks! Can you please also connect the speaker pin to the logic analyzer?

@arcostasi
Copy link
Author

However, there's one annoying thing: you don't see all the output immediately, as it takes a few microseconds for the USB to connect. This means that if you have a syntax error in your code, you'll need to press "Ctrl+D" to see it.

That is great! as soon as I have some free time I'll have fun with CircuitPython.

@arcostasi
Copy link
Author

Thanks! Can you please also connect the speaker pin to the logic analyzer?

A square wave appeared in the speaker channel (D2), but the audio did not play in my headphones.

logic-analyzer-2

@urish
Copy link
Contributor

urish commented Feb 27, 2022

Thanks! So I suspect an issue with the buzzer. Does the frequency of the square wave look correct? (you can ask PulseView to calculate the frequency by holding Shift and selecting the region between two adjacent peaks (low-to-high transitions).

Also, do you observe any difference when the buzzer is set to accurate mode?

@arcostasi
Copy link
Author

In accurate mode I can hear the sound with noises, even switching between the buttons.

analyser

@urish
Copy link
Contributor

urish commented Feb 28, 2022

Thanks @arcostasi. I think I found the issue with the smooth mode - it looked at edge-to-edge time instead of peak-to-peak time to determine the frequency. The ESP32 uses a non-50% duty cycle, so it confused the smooth mode algorithm:

image

You can see that the frequency is right, but the duty cycle (% of the time the signal is high in each cycle) is not 50%. This is different from how Arduino does PWM.

I have updated the algorithm, can you give it another go please?

@arcostasi
Copy link
Author

Hi @urish, it worked perfectly now! Thank you

@arcostasi
Copy link
Author

arcostasi commented Mar 1, 2022

@urish, I did another test with Franzininho WiFi, was the analog reading implemented? Thanks

Here is an example: RGB LED with Slide Potentiometer

@urish
Copy link
Contributor

urish commented Mar 1, 2022

was the analog reading implemented?

As far as I can tell not yet

@arcostasi
Copy link
Author

Ok, no problem! Thank you

@urish
Copy link
Contributor

urish commented Mar 1, 2022

Update: analogRead (ADC) implemented!

@arcostasi
Copy link
Author

Thanks @urish, worked perfectly!

@arcostasi
Copy link
Author

arcostasi commented Mar 24, 2022

Here's an example of using a servo with Franzininho WiFi

@urish
Copy link
Contributor

urish commented Apr 15, 2022

Documentation for the Franzininho WiFi board: https://docs.wokwi.com/parts/board-franzininho-wifi

@urish
Copy link
Contributor

urish commented Apr 16, 2022

The last missing feature is now ready: SPI support. Here's a quick demo:

https://wokwi.com/projects/329013233501340242

So now we have feature parity with the ESP32 and can declare the Franzininho WiFi simulation ready. Thanks for everyone who supported this feature :-)

@urish urish closed this as completed Apr 16, 2022
@urish
Copy link
Contributor

urish commented Apr 18, 2022

Franziniho WiFi now has a "New project" page: https://wokwi.com/projects/new/franzininho-wifi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open for vote Vote at https://wokwi.com/features
Projects
None yet
Development

No branches or pull requests

3 participants