Skip to content

Wemos Lolin C3 Mini Board #6256

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

Merged
merged 19 commits into from
Jul 5, 2022
Merged

Wemos Lolin C3 Mini Board #6256

merged 19 commits into from
Jul 5, 2022

Conversation

askpatrickw
Copy link

@askpatrickw askpatrickw commented Apr 6, 2022

This is board definition for the Lolin C3 Mini

TODO:
(Reworking all this based on a different baseline board defition (QtPyC3)

  • Should this be "lolin" or "wemos"? -- Using Wemos for company and using lolin in board name.
  • Question: I see IGNORE_PIN_ in the docs, but not in any Espressif board definitions. Should we ignore that for Espressif boards? --
  • Question: Adafruit_CircuitPython_NeoPixel is frozen, should it be? -- No. This board does not have a Neopixel
  • VID and PID are currently the same values as the the Lolin S2 Mini. Not sure if that is correct. NOPE, need a new PID, requested from Espressif.
  • QUESTION is the C3 Bin only? I set the build to BIN only as other C3 boards appear to be and the CI Failed. Yes they are BIN only.

Wemos Lolin C3 Mini Testing

  • SafeMode Boot by tapping Boot Mode on power on
  • Pin 0: A0:
  • Pin 1: A1:
  • Pin 2: A2: Pin 2 is always pulled high according to the schematic
  • Pin 3: A3:
  • Pin 4: A4:
  • Pin 5: A5: SDA: i2c.scan() worked
  • Pin 6: SCL: i2c.scan() worked
  • Pin 7: board.LED on\off works
  • Pin 8: Pin 8 is always pulled high according to the schematic
  • Pin 10:
  • UART (PIN: 20,21/A6,A7)
  • WIFI
  • BLE
  • rshell/ampy access: FAILING, they do not connect

image

Snippet of the Schematic

Some helper docs:

askpatrickw added a commit to askpatrickw/usb-pids that referenced this pull request Apr 8, 2022
I am working to bring up the C3 Mini on CircuitPython and we'll need a PID.
PR for that work here: adafruit/circuitpython#6256
@kylefmohr
Copy link

kylefmohr commented Apr 10, 2022

Hi, looking forward to testing this out later this afternoon! Regarding your second question, I would think it would be 'Lolin', based on their ESP32-S2 board which is supported https://circuitpython.org/board/lolin_s2_mini/

@askpatrickw
Copy link
Author

Yeah the Company appears to be called Wemos and the RTD url is Wemos.
https://www.wemos.cc/en/latest/c3/c3_mini.html

The Aliepxress store is Lolin.
https://lolin.aliexpress.com/store/1331105 and the descriptions mention Wemos.

But sometimes the boards have Lolin in the name on the Wemos RTD site, and in the silkscreen, sometimes they don't. https://www.wemos.cc/en/latest/index.html

🤷‍♂️ -- I'm going to leave it as Lolin unless someone corrects it.

@askpatrickw
Copy link
Author

askpatrickw commented Apr 13, 2022

I'm going to park this PR as a draft unless someone has an idea on how to get a CPY file onto the board without BLE workflow.

If you'd rather I close it and re-open later, that's OK too.

@askpatrickw
Copy link
Author

NVM about being blocked...
Neradoc pointed me at the QTPYC3 to compare to, and now I have REPL access so I'm not blocked.

@askpatrickw askpatrickw changed the title Lolin C3 Mini Board Wemos Lolin C3 Mini Board Apr 15, 2022
Spritetm pushed a commit to espressif/usb-pids that referenced this pull request Apr 18, 2022
I am working to bring up the C3 Mini on CircuitPython and we'll need a PID.
PR for that work here: adafruit/circuitpython#6256
@askpatrickw
Copy link
Author

Pin 2 an 8 are always pulled high according to the schematic so I'm checking those off the test list since I see that this is true when testing.

@askpatrickw
Copy link
Author

I'm flipping this to ready for review. It might not be perfect, but I think its working well. The one open item is the Creations ID and Repo, but I think when Scott is back that will be cleaned up and be implemented as I suggested and have it in the files.

@askpatrickw askpatrickw marked this pull request as ready for review May 5, 2022 21:42
Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One request. Wemos creations repo should be ready for a PR too.

Thanks for adding this board!

@prplz
Copy link

prplz commented May 11, 2022

Your pin naming isn't right. Circuitpython uses whatever the silkscreen says, in this case matching the IO# numbering. So IO0-IO10 should be D0-D10, etc.

@askpatrickw
Copy link
Author

Thanks @tannewt and @prplz I will look at this next week.

@askpatrickw
Copy link
Author

@prplz I'm back from my trip and hoping to finish this up ASAP. Now the I'm looking at the board, I don't see any "D" labels on the silscreen, so I'm confused. If you want to "@" me on Discord, we can do that too. Thanks for your help!

@prplz
Copy link

prplz commented Jun 12, 2022

@prplz I'm back from my trip and hoping to finish this up ASAP. Now the I'm looking at the board, I don't see any "D" labels on the silscreen, so I'm confused. If you want to "@" me on Discord, we can do that too. Thanks for your help!

Right, on the silkscreen they are just numbers. The naming in pins.c should match the silk, for example you have { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO0) }, but on the silk it's named 0. I said D but the convention seems to be to use "IO" for esp32 boards.

     { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO0) },
-    { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO0) },
+    { MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) },

     { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO1) },
-    { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO1) },
+    { MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) },

and so on.

@evildave666
Copy link

@prplz I'm back from my trip and hoping to finish this up ASAP. Now the I'm looking at the board, I don't see any "D" labels on the silscreen, so I'm confused. If you want to "@" me on Discord, we can do that too. Thanks for your help!

Right, on the silkscreen they are just numbers. The naming in pins.c should match the silk, for example you have { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO0) }, but on the silk it's named 0. I said D but the convention seems to be to use "IO" for esp32 boards.

There might be an argument for retaining an alternate "D" pin notation to match that of the D1 mini board, as there's an existing ecosystem of shields with markings matching those on the D1 board.

@prplz
Copy link

prplz commented Jun 13, 2022

There might be an argument for retaining an alternate "D" pin notation to match that of the D1 mini board, as there's an existing ecosystem of shields with markings matching those on the D1 board.

I see, maybe keep the D names and add IO as well?

@askpatrickw
Copy link
Author

OK, I wasn't understanding this 100%, but I took a picture of the board, zoomed in, followed the traces and I get it now. In the passing of time, I have no idea why I used those D Mappings. Latest commit maps the silkscreen numbers to the correct pins (D to GPIO).

The IO:GPIO mappings are 1:1 aligned. There are always the same according to my reading of the schematic.

With two possible extraneous extra IOs. IO20, IO21 are not on the schematic for GPIO20, GPIO21, they are labeled RX and TX instead. Let me know if those IO mappings should be removed or if they are also valid.

thank so much!

Copy link

@kylefmohr kylefmohr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the build is failing because your fork is a ways behind the main branch. If you fetch the upstream, it may fix the build issues.

@kylefmohr
Copy link

I think the build is failing because your fork is a ways behind the main branch. If you fetch the upstream, it may fix the build issues.

I was able to confirm this by forking adafruit:main with the most recent commits and applying the changes made by askpatrickw:lolin-c3-mini. Everything built successfully here

@evildave666
Copy link

evildave666 commented Jun 19, 2022

This board seems to have a hardware issue that it needs to have TX power explicitly adjusted away from default for wifi to function (I've verified this in Micropython - won't connect at default power but after adjusting it works fine and a similar caveat exists in Wemos' arduino documentation). I don't believe the circuitpython wifi library for ESP32 has a runtime setting for this (Micropython has sta_if.config(txpower=xxx) but an equivalent does not appear to exist in Circuitpython) so it might have to be set in board.c

@kylefmohr
Copy link

This board seems to have a hardware issue that it needs to have TX power explicitly adjusted away from default for wifi to function (I've verified this in Micropython - won't connect at default power but after adjusting it works fine and a similar caveat exists in Wemos' arduino documentation). I don't believe the circuitpython wifi library for ESP32 has a runtime setting for this (Micropython has sta_if.config(txpower=xxx) but an equivalent does not appear to exist in Circuitpython) so it might have to be set in board.c

Interesting, that explains why my build wouldn't connect to Wi-Fi. Here's a link to their documentation regarding this for MicroPython

@tannewt tannewt added the board New board or update to a single board label Jun 22, 2022
@askpatrickw
Copy link
Author

askpatrickw commented Jun 23, 2022

I think the build is failing because your fork is a ways behind the main branch. If you fetch the upstream, it may fix the build issues.

Thanks @kylefmohr this PR got old... I appreciate the reminder.

@askpatrickw
Copy link
Author

Thank you @todbot! I'll try that later tonight or tomorrow night.

@todbot
Copy link

todbot commented Jun 29, 2022

ooof I'm looking in: esp-idf/componenents/esp_phy/esp32s2/include/phy_init_data.h and similar files grepping for "TX_POWER" and am really wishing CircuitPython had access to esp_wifi_set_max_tx_power()

@tannewt
Copy link
Member

tannewt commented Jun 29, 2022

ooof I'm looking in: esp-idf/componenents/esp_phy/esp32s2/include/phy_init_data.h and similar files grepping for "TX_POWER" and am really wishing CircuitPython had access to esp_wifi_set_max_tx_power()

Feel free to add it! It makes sense that Radio would have a tx_power attribute.

@askpatrickw
Copy link
Author

I opened a Feature request for wifi.radio.tx_power() #6540

@askpatrickw
Copy link
Author

OK, if this build works, and it should, I just tested wifi.radio.connect with the wifi.radio.tx_power, this is ready for final review.

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@tannewt tannewt merged commit 459f5d0 into adafruit:main Jul 5, 2022
@askpatrickw askpatrickw deleted the lolin-c3-mini branch July 5, 2022 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
board New board or update to a single board
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants