-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Understanding differences between CircuitPython versus Micropython - examples Uarts/SD(Teensy) #6276
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
Comments
port-specific behavior is different between micropython and circuitpython. only core language elements are the same. |
The core language part of CircuitPython is very close to MicroPython, and we merge regularly from upstream. However, the native modules to do I/O, etc. are different. We try to be consistent across ports, so that it's easy to move code. We may do this at the expense of exposing particular features of a particular chip family, unlike MicroPython, which is willing to expose chip-specific features more readily in the basic I/O modules. At the time we forked from MicroPython, there were different native modules to support different ports ( There is a somewhat longer discussion here: https://discord.com/channels/327254708534116352/327254708534116352/908084497176756274 and several other places Please join us in https://adafru.it/discord in #circuitpython-dev if you would like to discuss this more casually. |
We have an open issue for SDIO on i.MX: #4020. See the tag
mimxrt10xx
|
@dhalbert @ladyada - Thanks for the quick responses. Yes I noticed that there was an open issue on SDIO, Sorry I probably should have mentioned that in my opening post here. Note: I did mention that there were a few options to implement it, sort of referred to it in my option a) by mentioning the STM implementation. Which would take a major rework, as it is all geared around the STM SDK... In most of the other stuff I mentioned, I don't think most of it is mimxrt10xx hardware specific. But will check to see As for making the user code consistent across ports, is a great goal, but tricky. For example, even simple things, like what do you call your IO pins in boards object? For some you have names like: IO2, where as Teensy boards it is D2, whereas MicroMod, it is names like G2... For Uarts, putting in specific pin numbers/names in for TX and RX is mostly hardware specific. The more interesting questions have to do with things like overlapping IO and speed and consistency of speed of IO operations and the like. But that looks like something to be discussed elsewhere. The main thing for me to decide now is... What do I want to do? |
Yes, for pins, people often have to change the pin names, because of restrictions on which peripherals can use which pins, or due to historical differences in pin numbering: Arduino style, ESP32 style, etc. |
Sorry,
Not sure if this is best asked here or up on forum, Also lost first pass of typing this in, so will probably be more brief
which may not be a bad thing.
As @mjs513 and myself have been experimenting with CircuitPython and MicroPython, I am trying to understand the relationship between the code bases. From Github, my impression is that this is a fork of MicroPython so would expect a lot of basic stuff to be common.
Also I am mostly mentioning Teensy here as that is what I am working on and more familiar with, but a lot of this would mostly likely apply to other boards as well.
Things like:
Creating of UART Objects
Example wish to create two uart objects for what in Arduino are Serial1 and Serial4 on T4.1.
With MicroPython would do something like:
With CircuitPython something like:
Or with current stuff pulled in the last one can be done like:
Why complete different? Both have pluses and minus.
Asynchronous UART output
More fundimental issue. As I mentioned in the issues: #6263 and #6254
Some code like:
The code waited for each write to complete before it continued, which was totally unexpected by me as I would hope

that the code could continue to do other things. Also there was a pretty large gap between each operation
But from 6254:
When try something similar on MicroPython:
I see output that is more what I expected:

Teensy SDIO Support
Currently there is no code support within the ports for Teensy boards to support an SDIO, where as there is support within
MicroPython.
For example I have a Teensy 4.1 plugged in with an SDCard inserted within the built in SD slot.
For example with REPL I have:
Looking to try to add SDIO support, but hard to know good starting point, a couple of options include:
a) try to copy and rewrite the code for STM to be IMXRT1062 based.
b) Try to start from the MicroPython code base, but your HAL/SDK code is significantly different.
c) Try to bypass most of it and start with Teensy SDFat like code.
DigitalIO
Sorry minor comment.
Turning an IO pin on and off is different.
MicroPython:
CircuitPython:
I can work with either, I do find the on() and off() to be more readable... But.
Again sorry, I am not sure if this is the appropriate place to ask and probably some/all of this
has been answered before.
Kurt
The text was updated successfully, but these errors were encountered: