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

FireBeetle 2 ESP32-S3 #8623

Merged
merged 13 commits into from
Nov 21, 2023
Merged

FireBeetle 2 ESP32-S3 #8623

merged 13 commits into from
Nov 21, 2023

Conversation

bill88t
Copy link

@bill88t bill88t commented Nov 17, 2023

New superboard.

Mandatory port checklist:

  • TinyUF2 (Add FireBeetle 2 ESP32-S3 tinyuf2#361).
  • Pins.
  • Dual I2C busses.
  • Ensure camera pinout works.
  • Controllable shutdown with PWR pin.
  • Get the power management module in the core as a frozen module.

usb vid/pid:

image

The camera currently doesn't work as upon init the board safemodes due to memory.
It's 3 am, I am not even gonna think about it.

It's probably good to merge after I do the PWR stuff, since I won't be able to test the camera until the memory side of espcamera is fine.
I will open a seperate issue, probably tomorrow.

@bill88t
Copy link
Author

bill88t commented Nov 17, 2023

The pin definition is pretty massive, if someone wants to, I would appreciate a double check.

Schematic: https://dfimg.dfrobot.com/5d57611a3416442fa39bffca/wiki/a2283283b455fe95377e5d0d423539d9.pdf
Pinout: https://dfimg.dfrobot.com/nobody/wiki/0aa4e609926355484ad0cab49548d2f3.jpg

@bill88t
Copy link
Author

bill88t commented Nov 17, 2023

Got the camera working, HOWEVER we need to add a new frozen mpy for the AXP313A pmic, since the camera starts up with 0V supplied to it.
I have the module downstream and it works.
I did measure all the voltages, and they are correct.

The rest of the port definition is done.

@tannewt
Copy link
Member

tannewt commented Nov 17, 2023

Got the camera working, HOWEVER we need to add a new frozen mpy for the AXP313A pmic, since the camera starts up with 0V supplied to it.

Why do you need to freeze it? Generally you should only do that when you need to save RAM space.

@bill88t
Copy link
Author

bill88t commented Nov 17, 2023

Why do you need to freeze it? Generally you should only do that when you need to save RAM space.

Because I do not know how to include a python module, for one specific board, inside the core, in another way.

@dhalbert
Copy link
Collaborator

If it's just a library, why put it in the core? If it's a separate library, it can be updated without having to rebuild CircuitPython. It's ok to have a library for one specific board.

@bill88t
Copy link
Author

bill88t commented Nov 17, 2023

It's a library yea, but the board needs it to use it's camera. It cannot use it without it.
So out of the box, the camera would be unusable.

@dhalbert
Copy link
Collaborator

So out of the box, the camera would be unusable.

That kind of thing is true of boards we have with onboard accelerometers or other onboard things, too. You just have to load the library. It is a trade-off of convenience vs flexibility.

We do have a few manufacturers who have elected to freeze a lot of stuff, mostly on educational boards.

@bill88t
Copy link
Author

bill88t commented Nov 17, 2023

This board has an n16r8 module (it's the only spec, it has a -U variant though), on a regular build it has over 500kb free flash on the app partition and around 250kb on a debug build (with nothing removed).

The gains far surpass the costs of including it, especially considering it's just 1.6kb.
I want to make this port perfect.

@bill88t
Copy link
Author

bill88t commented Nov 17, 2023

Unless something better is proposed, or the inclusion is NACK'ed, I will continue trying to make it a frozen mpy.
I am willing to transfer the repo once it's done.

@bill88t
Copy link
Author

bill88t commented Nov 18, 2023

The module is now included, and works as expected.
It's currently on the repo https://github.com/bill88t/CircuitPython_AXP313A

I will continue to maintain the module and ship incremental fixes and updates.
If Adafruit wants to own the repo, that is fine by me, and I will transfer it.

>>> import storage; storage.erase_filesystem()

[13:16:35.031] Disconnected
[13:16:36.032] Warning: Could not open tty device (No such file or directory)
[13:16:36.032] Waiting for tty device..
[13:16:43.038] Warning: Could not open tty device (Permission denied)
[13:16:43.038] Waiting for tty device..
[13:16:44.039] Connected
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.

Press any key to enter the REPL. Use CTRL-D to reload.

Adafruit CircuitPython 9.0.0-alpha.5-9-ga05259db00 on 2023-11-18; DFRobot FireBeetle 2 ESP32-S3 with ESP32S3
>>> import board
>>> from AXP313A import *
>>> a = AXP313A(board.CAM_I2C())
>>> enable_camera(a, camera_voltages.OV2640)
>>> import espcamera
>>> b = espcamera.Camera(data_pins=board.CAM_DATA, pixel_clock_pin=board.CAM_PCLK, vsync_pin=board.CAM_VSYNC, href_pin=board.CAM_HREF, external_clock_pin=board.CAM_XCLK, external_clock_frequency=20_000_000, powerdown_pin=None, reset_pin=None, i2c=board.CAM_I2C(), pixel_format=espcamera.PixelFormat.JPEG, frame_size=espcamera.FrameSize.VGA, jpeg_quality=11, framebuffer_count=1, grab_mode=espcamera.GrabMode.LATEST)
>>> b.sensor_name
'OV2640'
>>> b.take()
<memoryview>
>>> b.take()
<memoryview>
>>> b.take()
<memoryview>
>>>

@bill88t
Copy link
Author

bill88t commented Nov 18, 2023

Ci is failing consistently, not sure why.

@bill88t
Copy link
Author

bill88t commented Nov 18, 2023

Thanks to Jepler's fix, CI is passing now.
The port is complete.

.gitmodules Show resolved Hide resolved
@dhalbert
Copy link
Collaborator

Yes, a numbered release of the library is required.

@bill88t
Copy link
Author

bill88t commented Nov 19, 2023

Updated to use the cookiecutter style, added black formatting and created tags. I do not have any readthedocs experience, and I would like to skip it for now.
Once I get to know it a bit more, I will update the library accordingly.

@dhalbert
Copy link
Collaborator

@bill88t Did you see this guide, which has ReadTheDocs info? https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library

Copy link
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

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

One minor thing.

The frozen library is OK with me, but minimizing PR's to update the library would be good. I don't want to have to churn all of CircuitPython for that. If you are going to write this up, describe how to override the frozen library by putting the newer version in the top level of CIRCUITPY.

>>> sys.path
['', '/', '.frozen', '/lib']

@bill88t
Copy link
Author

bill88t commented Nov 21, 2023

I setup readthedocs https://circuitpython-axp313a.readthedocs.io/
and added notices for overriding the frozen module in both the docs and the readme.

I hope I did it alright. It certainly looks fine but idk, it's 5am.

@dhalbert
Copy link
Collaborator

Also I noted something in the README in the library: bill88t/CircuitPython_AXP313A#1 (comment). Assuming you fix that, you may want to re-release and advance the version in this PR.

But go to sleep :)

bill88t and others added 2 commits November 21, 2023 14:32
It's co-commit time.

Co-authored-by: Dan Halbert <halbert@halwitz.org>
@bill88t
Copy link
Author

bill88t commented Nov 21, 2023

Alright, fixed. Thanks for the heads up about the frozen module prioritization!

Copy link
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

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

OK, great! Thanks for persevering with our requests.

@dhalbert dhalbert merged commit 8c1a365 into adafruit:main Nov 21, 2023
15 checks passed
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

Successfully merging this pull request may close these issues.

None yet

4 participants