[Page Update][Enhanced Function]Optimized application of XIAO ESP32S3 Sense in CircuitPython and MicroPython
Overview
We need your help to enable our users to be able to fully access and control all pins through CircuitPython and MicroPython on XIAO ESP32S3 Sense devices, and be able to efficiently use the camera module(espcamera), providing powerful tools and documentation support for developers. So that they can more easily implement complex projects and applications.
- Full PIN support: Ensure that CircuitPython and MicroPython can take full advantage of all pins on XIAO ESP32S3 Sense.
- Camera module optimization: Optimize
espcameramodule in CircuitPython environment to improve the performance and stability of camera module. - Wiki Documentation Updated: Update our wiki: XIAO ESP32S3(ESP32 chip) with CircuitPython and XIAO ESP32S3 with MicroPython.
How do we work together?
- Leave a comment with your GitHub name below as you accept this assignment and will complete the contents about what we are trying to present.
- The maintainer will assign and record you as our only contact for this assignment.
- You can first Deploy this Wiki Platform Locally (The entire source code .zip file is only 30 M)
- You will be invited as our "Contributor" once you "Pull Request".
- The maintainer will review the PR and then merge.
What do we offer?
We want to express our gratitude to our contributors by offering a range of rewards. Depending on the difficulties(Tier 0/1/2/3), the time we expect(Days 1/3/7/15), the actual submission time and the actual submission contents, we will offer different levels of rewards.
- We will provide our products or cash bonus to our contributors as a token of appreciation.
- For those contributors who join our "Ranger Program"(announced soon), we offer even more exciting rewards, including access to our prototype products.
- In addition, all contributors and their contributions will be acknowledged and showcased on our wiki platform.
FAQ
- For any question, the contributor can directly commend here.
I think I can complete the assignment, but I need more time?
- The timeframe here is based on our old experience, from people who has done it or something like that.
- However, many projects will take much more time under actual circumstances (including the main language of the contributors receiving the task and the actual creative difficulty)
- You can leave the time you need and a brief reason, we will evaluate the situation accordingly.
π @MatthewJeffson
Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible. Please make sure you have given us as much context as possible.
I have already made some implementations in the files to compile Circuitpython for the board, adapting the pin names to the Xiao standard and including the pins used by the camera. But I'm having trouble getting the correct settings for the board's memories (Flash and PSRAM). The firmware I have already compiled for the board does not work and I believe it is because of these settings.
IIf you could help me with this information, I could probably solve this problem.
Hello! @djairjr Djair! Thanks for considering this assignment! What help do you need? Best Regards, Matthew
Sorry Matthew. I am involved with my Grove Vision AI V2 project and abandon here. The chip of PSRAM memory in Xiao ESP32-S3, correct specs. In Circuitpython source there is some models of Adafruit that uses same ESP32-S3 and PSRAM improvement. In that config file, the correct memory specs is needed. I am also speak with people on Adafruit and they said to me that Seeed need to fill some kind of form on web and register Xiao ESP32-S3 as ESP32 board in some manner. They probably tell them the same thing.
If you can pass me this info, I will update my source and compile it here. I have a bunch of Xiaos here...
I've already fill the camera pins on my source file, but I believe that some work in espcamera need to be done.
Ok! Found it on schematics.
GD25Q64ENIGR - 8MB Flash https://www.mouser.com/datasheet/2/870/gd25q64e_rev1_4_20210820-1825464.pdf
I will try later.
Talking to Circuitpython support and there is a lot of miscommunication: https://github.com/adafruit/circuitpython/pull/8095
Seeed need to: Please get a unique PID for this board instead of using the generic one. https://github.com/espressif/usb-pids
I think this is something that Seeed Studio should address?
Yes, we asked them for it on their forum, at https://forum.seeedstudio.com/t/usb-vid-pid-for-the-xiao-esp32-s3-and-xiao-esp32-s3-sense-for-circuitpython/272245/10 but either they don't understand, or they are not interested.
https://github.com/adafruit/circuitpython/issues/9507
Done it. Please test and see if its ok. https://github.com/djairjr/Seeed_Xiao_ESPS3_Sense_Circuitpython Upload it with WebEspTool at https://adafruit.github.io/Adafruit_WebSerial_ESPTool/ Address 0x0 firmware.bin file
Here is a dump for my board:
Adafruit CircuitPython 9.2.0-alpha.2350-17-g422eb7eff2 on 2024-08-15; Seeed Xiao ESP32-S3 Sense with ESP32S3
>>> help ('modules')
__future__ codeop max3421e supervisor
__main__ collections mdns synthio
_asyncio countio memorymap sys
_bleio digitalio microcontroller terminalio
_eve displayio micropython time
_pixelmap dualbank msgpack touchio
adafruit_bus_device epaperdisplay neopixel_write traceback
adafruit_bus_device.i2c_device errno nvm ulab
adafruit_bus_device.spi_device espcamera onewireio ulab.numpy
adafruit_pixelbuf espidf os ulab.numpy.fft
aesio espnow paralleldisplay ulab.numpy.linalg
alarm espulp paralleldisplaybus ulab.scipy
analogbufio fontio ps2io ulab.scipy.linalg
analogio fourwire pulseio ulab.scipy.optimize
array framebufferio pwmio ulab.scipy.signal
atexit frequencyio qrio ulab.scipy.special
audiobusio gc rainbowio ulab.utils
audiocore getpass random usb
audiomixer gifio re usb.core
audiomp3 hashlib rgbmatrix usb_cdc
binascii i2cdisplaybus rotaryio usb_hid
bitbangio io rtc usb_midi
bitmapfilter ipaddress sdcardio vectorio
bitmaptools jpegio select warnings
board json sharpdisplay watchdog
builtins keypad socketpool wifi
busdisplay keypad_demux ssl zlib
busio locale storage
canio math struct
Plus any modules on the filesystem
>>> import board; dir (board)
['__class__', '__name__', 'A0', 'A1', 'A2', 'A3', 'A4', 'A5', 'D0', 'D1', 'D10', 'D2', 'D3', 'D4', 'D5', 'D6', 'D7', 'D8', 'D9', 'I2C', 'I2S_FS', 'I2S_MIC', 'LED', 'MISO', 'MOSI', 'MTCK', 'MTDI', 'MTDO', 'MTMS', 'PCLK', 'RX', 'SCK', 'SCL', 'SDA', 'SDCS', 'SPI', 'TX', 'UART', 'VSYNC', 'XCLK', 'Y2', 'Y3', 'Y4', 'Y5', 'Y6', 'Y7', 'Y8', '__dict__', 'board_id']
>>>
Tomorrow I will check if espcamera works.
Wow! @djairjr That is amazingly awesome! I can't say how much I been grateful! Thank you so much! Can I have you some other contacts? My email is [email protected] and my discord name is matthew_yu0310
Best Regards, Matthew
Matthew, there is only one problem, that I am trying to solve: The CIRCUITPY drive does not open in my Windows boot. Only on Linux boot. I believe that is related to this issue: https://github.com/adafruit/circuitpython/issues/9384
Maybe if you compile it using WSL it works. It is a Circuitpython source bug, with Ubuntu and Debian since version 8.
Matthew, the Read Only File System in windows is related to this problem with USB PIDs, that I mentioned before. Appears that windows need this data to correct identify your board as USB Drive. https://github.com/espressif/usb-pids For now, it works with Espressif equivalent board USB_VID and USB_PID. USB_VID = 0x303A USB_PID = 0x80D1
The link for download is that: https://github.com/djairjr/Seeed_Xiao_ESPS3_Sense_Circuitpython/tree/main/seeed_xiao_esp32s3_sense
But, in order to be fully suported for Adafruit, you will need to solve this issue with PID.
Ok Matthew, i got a fully functional version of Circuitpython for this board. Tested the camera with the Xiao Round Display and everything works great. The problem with the USB_PID and USB_VID still needs to be addressed and this is preventing my changes from being included.
If you meet the requirements of the folks at Adafruit, support for this board will be officially included in Circuitpython and nothing more needs to be done.
Their version control system detects that there is a duplicate USB_VID / USB_PID (yes, because I copied it from another board to do the compilation and testing). Once Seeed correctly fills in these values ββin the mpconfigboard.mk file, the system will release the merge and we will have official support for the board.
Running USB VID/PID and Creator/Creation ID Duplicate Checker...
Duplicate VID/PID usage found!
- VID/PID: 0x303A:0x80D1
Boards: seeed_xiao_esp32_s3_sense, unexpectedmaker_tinys3
If you are open source maker, then you can request a PID from http://pid.codes
For boards without native USB, you can request a Creator ID from https://github.com/creationid/creators/
Otherwise, companies should pay the USB-IF for a vendor ID: https://www.usb.org/getting-vendor-id
FAQ: Why does CircuitPython require a unique VID:PID for every board definition? https://learn.adafruit.com/how-to-add-a-new-board-to-circuitpython/frequently-asked-questions#faq-3130480
You can download and test Circuitpython 9.1.1 and Circuitpython 9.2.0 https://github.com/djairjr/Seeed_Xiao_ESPS3_Sense_Circuitpython/tree/main/seeed_xiao_esp32s3_sense/seeed_xiao_esp32s3_sense
The code below displays camera frames on the Xiao Round Display at a rate of 8 to 24fps.
import board, busio
import displayio
import espcamera
import adafruit_ticks
import gc9a01
import struct
i2c = busio.I2C(board.SCL, board.SDA)
spi = busio.SPI(clock=board.SCK, MOSI=board.MOSI)
cam_i2c = busio.I2C(board.CAM_SCL, board.CAM_SDA)
tft_dc = board.D3
tft_cs = board.D1
tft_bl = board.D6
display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs)
display = gc9a01.GC9A01(display_bus, width=240, height=240, rotation=0)
# Appears that this example does not use Displayio at all
# print frame directly on display_bus to be faster
# so, rotation setting not works...
main = displayio.Group()
display.root_group = main
# Camera Init
cam = espcamera.Camera(
data_pins=board.CAM_DATA,
external_clock_pin=board.CAM_XCLK,
pixel_clock_pin=board.CAM_PCLK,
vsync_pin=board.CAM_VSYNC,
href_pin=board.CAM_HREF,
pixel_format=espcamera.PixelFormat.RGB565,
frame_size=espcamera.FrameSize.R240X240,
i2c=cam_i2c,
external_clock_frequency=20_000_000,
framebuffer_count=2,
grab_mode=espcamera.GrabMode.WHEN_EMPTY)
# Sending init bytes to display_bus
display_bus.send(36, struct.pack(">hh", 0, 239))
display_bus.send(42, struct.pack(">hh", 0, 239))
display_bus.send(43, struct.pack(">hh", 0, 80+239))
display.auto_refresh = False
t0 = adafruit_ticks.ticks_ms()
while True:
frame = cam.take(1)
if isinstance(frame, displayio.Bitmap):
display_bus.send(44, frame)
t1 = adafruit_ticks.ticks_ms()
fps = 1000 / adafruit_ticks.ticks_diff(t1, t0)
print(f"{fps:3.1f}fps") # typically runs at about 25fps
t0 = t1
Using the PDM Microphone still is not possible due an implementation of Espressif itself. But I've signaled the pins as MIC_CLK and MIC_DATA. As soon as Espressif solve this issue, we will have this implementation too.
As soon as you address the problem with the PID and VID, I can produce a tutorial detailing how to use the board's features.
Matthew, this is not related to Seeed Xiao ESP32S3 Circuitpython support, but I've a full tutorial in hohw to use SenseCap Watcher REPL, with full console commands. See if its useful for you: https://www.hackster.io/nicolaudosbrinquedos/hands-on-sensecap-watcher-6c6f99
Hello! @djairjr
I have seen the PR and thank you so much for detailed information here! It is really amazing! Regarding the
The CIRCUITPY drive does not open in my Windows boot. Only on Linux boot. I believe that is related to this issue: https://github.com/adafruit/circuitpython/issues/9384
I will check with R&D department and may get feedback to it as soon as possible.
Best Regards, Matthew
β @MatthewJeffson
This issue is closed, If you have any questions, you can comment and reply.
Guys, is there still something missing to give official support to this board? I understood that everything was correct, but I still don't see it in official support. If you need anything else, please let me know. I believe I have solved all the problems.