#circuitpython-dev
1 messages Β· Page 194 of 1
Unfortunately it's the latter: all those pins share the duty cycle value, changing one makes the output of all the linked pins change.
I ordered an nRF52840-DK so I can play with the port of CP some.
Finally some progress on this! I've got WizNet5500 support with LWIP for M4 and without LWIP for M0 and M4. LWIP is a bit of a resource hog so depending on what you're doing the non-LWIP version may work better for you.
Needs to be cleaned up and rebased before PR, but work in progress:
https://github.com/nickzoic/micropython/tree/circuitpython/nickzoic/703-wiznet-5500-samd
Support for WizNet5200 and ATWINC1500 to follow, I hope.
^ Yay!
@crude fossil nice!
[novel inbound!] @slender iron in sitting back down with the datasheet, and pondering reading COUNT vs CC[x], i don't think that will work. it would be limited to speed of the "control" (can't find a good name for it) timer and it's interrupt. the only way i can think of to reliably know if we've had a capture is to set EVACT = RETRIGGER, so that the COUNT starts over each time. i'll try and graph out what i suspect could happen:
Control Timer: TOP == 6535 (1ms, or 65535/1000), interrupt on OVF (^)
-----------^-----------^-----------^-----------^
-----^-------^-----^-----^----------------^----------
Capture Timer: No interrupts, capture retriggers count to start over or OVF occurs (^).
Another option is available besides DMAing the capture events. ONESHOT. I debated in the beginning of using it on the call to get the value, but didn't want it to block out every read.
am i over thinking this (again...probably)?
since the numBytes is dynamic -> pattern_size is dynamic as well.
You can allocate a variable-length array on the stack in C99: https://gcc.gnu.org/onlinedocs/gcc/Variable-Length.html
@arturo182:
Could you please rewrite this using pulseio/PWMOut.c or at least nRFx? Writing directly to registers is not very portable or future-proof :(
@hathach Is this same code, more or less, being used in the nrf52 Arduino library?
I agree in the long run it would be nice to be more portable, but if this code already works, we can use it for now, and open an issue to rewrite it later. I am mostly concerned that the PWM usage not mess up PWM usage in pulseio., but it appears the ...
I thought it is still used malloc under the hook ? btw, can the stack handle 12K bytes for 250 pixel ?
I believe it does allocate it on the stack, But, 12kB on the stack, good point, maybe not. Advantage of using the stack is no fragmentation.
@dhalbert it is virtually the same code from Arduino library with modification to remove 400KHz support. It is all laid out to avoid pwm conflict, only use available channel, and fall back to interrupt method otherwise.
@dhalbert ah thanks, I know variable array declaration. But always thought compiler will use some kind of malloc under hook. Allocating in stack is new to me :D . Is it compiler defined behavior or std behavior ?
It's in the C99 spec for the C language. See that link above.
Just read the text, I didn't see it say where the memory is located but it indeed implies the stack. Sorry for not being clear, I mean placing memory on stack is C99 specs or it allows compiler implement variable length array anyway it likes. Just Out of curiosity, since I don't use var len array much.
never mind !! I guess knowing gcc behavior is good enough.It cover 95% of cases :D
@raven canopy its fine if its limited to the speed of the control timer. People can use PulseIn for low frequency measurements
regarding malloc, will the alignment be multiple 4, or it can be odd. This example need the allocated mem is align of 2 for uint16_t
Looks like malloc() is 8-byte aligned: https://www.gnu.org/software/libc/manual/html_node/Aligned-Memory-Blocks.html. The idea is that malloc() is aligned to the largest scalar datatype provided by the compiler.
Actually this calls the gc alloc, and a quick glance doesn't show me the alignment. But it's at least *4 aligned.
@hathach What kind of NeoPixels did you test this with? Both SK6812 and WS2812?
@dhalbert wake up so early :D, the pixel is WS2812, I test with the featherwing 8x4 neopixel
Thanks, at least 4 is perfect, it will work with this.
please run more tests, I only type in and manually test with a couple of neopixel, a full strandtest should be better.
Could you put comments on each of these args (make them one per line) to make this easier to read and to change?
Just an idea: how about encoding the necessary delay as yet another byte, like length? Units would be 5's or 10's of msecs.
Capitalized Display? To be consistent with I2C, UART, etc.
constants would probably be a cleaner way
These are MIPI DCS commands: 0x2a, 0x2b, 0x2c
Spec: https://www.tonylabs.com/wp-content/uploads/MIPI_DCS_specification_v1.02.00.pdf
These are the names Linux uses: include/video/mipi_display.h
I think those are the least confusing of the whole constructor, I meant more for the pins it would be nice to know which is DIN, CLK, DC, CS and what the 2, 0, 16 mean.
My nRF52840-DK arrived this morning. Digikey is amazing BTW π
CircuitPython up & running with no problem.
The gc allocates 16 byte blocks that are 4 byte aligned.
@umbral dagger awesome, we just added neopixel
i will warn, the fs gets corrupted sometimes still
Will Approve after this is updated to fix the conflict. Thanks!
works great with my "jewel" on the feather_nrf52832. 3V power
and it works with "jewel" on the PCA10056 - also at 3V
It also works with an 8 pixel RGBW strip https://www.adafruit.com/product/2869 (aslo using 3V input) on the PCA10056 -- How can I tell if these are SK6812 or WS2812?
FYI - I am running the "color wheel" demo for these tests. No problems so far.
RGBW are always SK6812
old neopixel strips are WS2812, you can tell cause when you power them they 'flicker' once
@tannewt had to redo after merge due to pin struct changes; I forgot to try a recompile. Ready for another mini-review and travis is happy.
Thanks @slender iron ! it's awesome to see you reviving an older platform's compatibility . And also through python! I'd love it if we could chat later about the API you were mentioning! Always game to learn!
@marble hornet cool! I'm out for the night but the PR for it is here: https://github.com/adafruit/circuitpython/pull/1152
how does this hook into a display? or is this like a frame buffer ?
remove a resistor, add a resistor, and my 4-channel midi shield is safe for a metro m0/m4
Hi folks - anyone know if CP can read input over USB? Ideally, I'd like to send serial commands to a CPX and have it change behavior. I would rather use MakeCode for this (it's an intro project), but I don't think it can read over USB.
CP on CPX does serial over USB nicely
Excellent!
THough on close examination, it might depend on what sort of data. Most people use input(), which is blocking and waits for return
find for line oriented data, not so fine for 'streaming' data
there is a discussion, a bit old, here:
https://learn.adafruit.com/welcome-to-circuitpython/kattni-connecting-to-the-serial-console
oops
I'm not picky
play around with input() then, it might get the job done
input() will get me started - I can update when non-blocking read is implemented. @tulip sleet and @slender iron please add me to the folks looking forward to that π
would would be the syntax to something like board.gatepin[i] instead of for example board.D4
trying to minimize the amount of repeated lengthy statements
gatepin = ('D4,'D5','D6','D7)
er 'D7'
@ruby lake i think you'd have to have a list containing the board.pin objects:
>>> gatepin = [board.D5, board.D6, board.SCL]
>>> for pin in gatepin:
... type(pin)
...
<class 'Pin'>
<class 'Pin'>
<class 'Pin'>
unless, you're sub-classing the board module?
yeah I did that and it worked
I am setting up D2 through D10 all as outputs trying not to eat up memory space with nine individual config blocks
@raven canopy it is just I am OCD to the point I wanted to get the repeated 'board' strings out of the list π
hehe. nothing OCD about that. you could do the whole from board import D1, D2.
though, that can get messy sometimes if the names are common...
yeah
So... my code's working great when using the Mu console... or using Putty to connect to the serial port
However, when I try to write the information directly to the port using the Windows command line or PowerShell, it never returns from input()
Is this a newline issue? ASCII vs. UTF?
i was beginning to think that when i was plugging at it last week. (sorry...been working other things this week)
So, I have changed my comparison to .startswith() instead of == and that lets it work from the command line
echo green >\.\COM30
sends green and it catches it
but the PowerShell doesn't
Makes me think it's sending some unicode "green"?
HAHAHAHA
It works
To send a "Unix-ish" carriage return/line feed, you need to do Write("yourtextrn")
that's "yourtext<BACKTICK.r<BACKTICK>n"
not backslash, BACKTICK
like escape character really needed to be redefined in PowerShell (dummies)
i think that is the only combo i didn't try. i tried all manner of '`n`lf', '`n`n', '`r', etc...
No, just treat it like NORMAL strings with backslashes, but use backticks
the backslashes were just to escape the ` character here.. π
function sendColor($colorName)
{
$portInfo = ( Get-WmiObject Win32_SerialPort | Where { $_.PNPDeviceID -like 'VID_239A' } | select -last 1 )
$port = new-Object System.IO.Ports.SerialPort $portInfo.DeviceID,9600,None,8,one
$port.open()
$text = $colorName + "rn"
$port.Write($text)
start-sleep -m 50
$port.ReadExisting()
$port.Close()
}
sendColor("red")
the line starting with $text = has two backticks before and after the r
if you put a \ before the ` it will print without markdowning it.
i still can't get it to respond to control characters... π¦ but, glad it is working for your case!
actually...control characters work! must've needed a reset.
# '^' = Ctrl
$port.Write("^{C}`r`n")
well, its definitely finnicky...
OK so this is working support for the WizNet 5500 on Metro M4 Express (with or without LWIP) and Metro M0 Express (no LWIP for M0, sorry, won't fit!).
To do: make this work within the shared-bindings / common-hal layout used by CircuitPython.
(WIP: Shared here in the spirit of "Commit early, commit often" :-) )
@tough flax sys.stdin.read(1) will read a single character. Or change the 1 to how many you want to read. It is blocking.
Is there a version with a timeout? Or an βisAvailavleβ? Otherwise the input is working
unfortunately no not yet
lots of discussion here https://github.com/adafruit/circuitpython/issues/231
UART has a timeout and we have a bugfix for zero-timeout. but you want from USB. you could use a separate USB-serial cable and use the TX/RX pins, but that's annoying
i have to sleep but take a look. as mentioned in that issue there's no simple native way in CPython.
@tulip sleet I see that there is now a build for the PCA10059 -- it builds -- I tried just loading it to the dongle (dfu-flash) but that did not appear to succeed. It loaded, but I was not able to communicate with it after that... Have you tried it? If so, How do you load/execute it? Sorry if I am jumping the gun on this. Just curious if it is usable. No problem if it is still a WIP.
unsure if dfu-flash is the correct way to do it, might have to flash the CP bootloader over jlink
@indigo wedge ah. I donβt see a bootloader for the pca10059. Yet...
hmm, the pca10056 might work, the pinout will be wrong for the buttons but maybe that doesn't matter if you don't need to enter the bootloader, because it enters bootloader if there is no valid firmware on first boot
Ok. Iβll solder a jlink connector on one and give it a try. Probably tomorrow. No rush on this. Couldnβt resist trying it!
BlTW when I loaded it via dfu-gen dfu -flash it seemed to load. No errors. I was encouraged π€
I the opened nrf-connect and updated the bootloader. Now back to where I started, I think. The jlink will be nice to have connected.
@indigo wedge on the PCA10056 -- the ble_scan is back to only showing one report. You fixed this once before, but I can't recall what you did. Do you remember this?
hmm, i remember the issue but not the solution
need to finish my ble rewrite, then we won;t have that problem
np - better to wait for the real fix.
ah i think i remember, it was that the scan has to be restarted after each result comes
in the driver
ok -- maybe thats a good project for me to dig into.
@solar whale I only did the pin work. I didnβt try it yet. Building a UF2 bootloader for it is another as yet undone task, but that should be easy.
yes, it should just be a matter of pins
@tulip sleet np - I'll be patient.. at least I'll try π
perhaps i can even try to add the bootloader
@solar whale @indigo wedge Started to make a PCA10059 bootloader. One minor issue is that there's only one GPIO button (there's a dedicated reset button). Bootloader expects at least two GPIO buttons, so that you can switch between bootloader modes. Could just choose a pin you could ground as "button" 2. Otherwise it looks really straightforward. Very minor variation on PCA10056.
@tulip sleet That sounds good to me. Thanks.
It's cool when people refer to things like building a bootloader as "should be easy". That tells me the tool chain and existing software are pretty solid and the folks here are smart.
nothing is ever easy when computers are involved
you might get lucky and it works at first try...
easy means I can be constructively lazy - someone else did work I can use
@gentle bronze are you there? Built a bootloader for pca10059 dongle but getting this for make BOARD=pca10059 SERIAL=/dev/ttyACM0 dfu-flash
...
Sending DFU start packet
Timed out waiting for acknowledgement from device.
Sending DFU init packet
is this going to work on linux?
port exists and LED is pulsing, showing inital bootloader is on-board
did you flash the bootloader to the board yet
this is a fresh board, no jlink, just trying DFU update of bootloader with our bootloader
not ours
oh, prob not unsigned, etc.
I have no idea which bootloader they put on the board
ok, I'll solder on an SWD connector. Was hoping to skip that initially
the dongle doc talks about using "nRF Connect for Desktops" and the DFU Trigger Library
page 9 in that doc
the bootloader packet won't be the same, the bootloader address is different, ucir need to be cleared and rewritten using nvmc module. this is tricky.
I will check their bootloader code, there may be a chance we could produce "nrf to adafruit" packet things. But I am not sure, we need to update their bootloader. which may be fixed
ok, jlink sounds much easier. Don't bother spending time on this now. I and the other people who want to try this can do jlink
OK, it is one-time thing, you can solder only SWIO and SWCLK, I think they have a pad for that
but since you are doing it first, better to just solder the whole SWD header π
thanks!
hehe. so its "easy+". π
touchΓ©
@tulip sleet Sorry this has taken so much of your time --- I should be able to spend time on it tomorrow.
no, not at all. I just got back from the YMCA. I spent about 15 mins rebuilding the bootloader. I want one too! I have two dongles.
@gentle bronze, or anyone nRF really, does nrfjprog truly need jflash 6.22, or can it use 6.30? i think having both installed is causing me some Atmel Studio programming woes...
mind you, i don't rule out the problem being with Atmel Studio itself.. π
I have never got any isuse with jlink and nrfjprog so far.
I am on ubuntu, what is your OS ?
maybe it is platform specific thing
Win10. i haven't had issues with nrfjprog either. i might just try uninstalling jlink 6.22 and test nrfjprog with jlink 6.30, and see if that also fixes my AS7 issues.
π
Adafruit CircuitPython 4.0.0-alpha-1056-g100603a60 on 2018-09-06; PCA10059 nRF52840 Dongle with nRF52840
>>>
>>> 1+2
3
will 4 have timer interrupt callback? π
The LEDS on the PCA boards are connected to VDD and need to be grounded to be lit. I used DriveMode.OPEN_DRAIN but the PCA10059 ones seem very faint still. Need to clean up GPIO open drain handling for nRF52 in CPy.
@ruby lake no, you still want it for the adc multiplexing?
@prime flower https://forums.adafruit.com/viewtopic.php?f=60&t=140621 when you have time
@slender iron it is a daydream I have. π I can get by without it.
micropython has one, and if I knew enough about writing external cp function calls I'd try to make it work
I think its easier to write a C module for the complex functionality you want
@slender iron probably
@gentle bronze I'm trying to make the MSC larger on my nRF52840 board and I noticed a strange thing, I made the FATFS 512KB so I changed #define CFG_TUD_MSC_BLOCK_NUM (512*1024)/512 and then when I connect the board to my PC I get [137545.843854] sd 4:0:0:0: [sdb] 1024 512-byte logical blocks: (524 kB/512 KiB) So it's 512 Kibibytes, so should I actually define BLOCK_NUM to (510*1024)/512 so it's 510 KiB = 512KB ? I'm just worried if the system thinks the drive is 524KB it might overwrite the flash past the FATFS region where the private data is supposed to be (I know we don't use that region yet but we might).
is there something in CircuitPython that I can use to export data to an excel table?
I want to record this data into excel:
import time
import microcontroller
from adafruit_circuitplayground.express import cpx
while True:
print("Ambient Room Temp:", cpx.temperature * 1.8 + 32)
print("CPU Temp:", microcontroller.cpu.temperature * 1.8 +32)
time.sleep(30)```
you can write it to a csv file and load that in excel
what do I use to do that?
not sure if CP has any modules for csv, but you can just open a file and write directly
@gentle bronze also these 3 lines are not used at all https://github.com/adafruit/circuitpython/blob/master/ports/nrf/usb/usb_msc_flash.c#L49
That data would be pretty easy to write out CSV, it has no funky quote/special character problems, etc
I figured it was simple, I just dont know how to do it.
print("{},{}".format(cpx.temperature * 1.8 + 32, microcontroller.cpu.temperature * 1.8 +32)
or, same line, but instead of print write it to a file
import the result file into excel whcih will have not problems with it (espcially if it has the extension .csv)
Needs another ) on the end π
https://learn.adafruit.com/cpu-temperature-logging-with-circuit-python/writing-to-the-filesystem gives a tutorial on writing to the file system
you just want to write out your values with commas in between for each value, and a new line for each value set
thanks @arctic heron
I tried this file and it works fine for me.
Did you modify the ImageLoad library to give the Bitmap the color count? https://github.com/adafruit/Adafruit_CircuitPython_ImageLoad/commit/b030ef70ef3f76cdda644d087dd55b2cff00ec72
I did all caps. Only doing the first letter looks too much like a class to me.
@tulip sleet think I should just copy this init format? https://github.com/adafruit/Adafruit-ST7735-Library/blob/master/Adafruit_ST7735.cpp#L11
GitHub
This is a library for the Adafruit 1.8" SPI display http://www.adafruit.com/products/358 and http://www.adafruit.com/products/618 - adafruit/Adafruit-ST7735-Library
I like append because it matches list. I want to add subscription support to this so it acts even more like a list in the future. You ok leaving it?
I did not, was I supposed to? :D I can try later with this change and I will let you know.
Nope since we don't do blending. Thing we should support binary transparency from it?
I just mean the order is lowest to highest. That's fine, as long as it's documented and consistent everywhere.
Binary transparency makes sense, since how would you do doughnut-shaped things, etc. otherwise?
PyCon Canada is in Toronto, Nov 10 & 11. CFP closes in 5 days. A) is anyone else thinking of going and B) is anyone planning to do a talk on CP? I'm planning to go and I'd be happy to give a talk.
Added a todo. We can expand it later as needed.
I was thinking of having them signed as a way to support sprites that are partially off screen.
Think its worth copying the Arduino format? Its close: https://github.com/adafruit/Adafruit-ST7735-Library/blob/master/Adafruit_ST7735.cpp#L11
Hello World! (First Post, please re-direct me if I'm in the wrong place.) I'm using an ItsyBitsy M0 Express to control a box that has a collection of lights, motors, sensors, etc. The box needs to be controlled by a PC running Matlab / Python. Is there a good way to set up a 'command manager' to watch the serial port for new instructions while still running lower-level operations in the background? Maybe something like the "second (raw) serial connection" mentioned in this post... https://github.com/adafruit/circuitpython/issues/231
Append places a child at a higher index than anything before it. The backwards loop starts with the last thing appended meaning its pixel value is used first.
Similar to the Arduino CmdMessenger... https://playground.arduino.cc/Code/CmdMessenger Thanks all!
The Arduino format looks like it would be very easy to convert to, and if it's is used for a number of displays, it would be very nice to just copy the tables.
But if you are running backwards, wouldn't overlapping items closer to the front of the list (processed later) overwrite the ones already processed?
Added a comment. It is log2(32 // bits_value). ceil isn't needed because bits_per_value is always a power of two. x_shift is used to determine what word to load the pixel value from. so the important lines of your test code are:
1 (5, 32)
2 (4, 16)
4 (3, 8)
8 (2, 4)
16 (1, 2)
Ya, without that you get a row packing warning. Not sure how you fixed it otherwise.
Yes, I believe it is consistent.
@tawdry wyvern its a super common request and is why we have that issue. Please post a me too to that issue to vote it up. π
I added support for it. Without it you'd need to make the index transparent by calling make_transparent.
Oh, x_shift is a word index, I thought it was a bit index. OK, that makes a lot more sense to me.
@slender iron Thx for the ping, I don't usually lurk the CP forum.
@slender iron Thanks for the info! Is "me too" a Discord thing? Or do you just mean commenting on the GitHub Issue #231 ? Also, at first glance it seems like it might be possible to implement a system with two separate boards : One to handle Communication over the Serial port and a second to handle box control with I2C, SPI, or UART comm between them. Does this sound reasonable, or like a rabbit trail?
Ditto to @protothesis comments above... and I was similarly directed by @tannewt from the Arduino Discord... My goal would be to have something similar to the Arduino CmdMessenger. Right now the best I can come up with is using two boards: 1 for communication via the Serial Console, and 1 for Device Control with a UART between them. If anybody has already been down that road, I'd love to hear about it...
I was working with adding an external power supply simlilar to what's shown. And Mu / Feather M0 did not like it.
darn, still hitting that import bug from time to time and have no idea why :/
an intermediate solution for now is to use the hardware UART + a usb/uart cable. elegant? not as much but it does work now :)
https://learn.adafruit.com/circuit-playground-express-serial-communications
(code works for any/all circuitpy boards)
The fourth byte isn't necessarily an alpha byte. (Its 0 in a BMP with indexed color.) So I call it a pad byte instead and ignore it.
@indigo wedge you mean the long-lived UART bug? It was fixed in 3.x but not yet in master.
@dhalbert Ok please take another look.
@TG-Techie I'm not sure what you mean by hook into. This isn't like framebuf because it stores individual objects on the screen as a way to minimize memory and bandwidth to the display.
no, CP master fails to import a file from code.py
Traceback (most recent call last):
File "code.py", line 6, in <module>
File "HomeScreen.py", line 7, in <module>
File "ui/gui/painting/Painter.py", line 3, in <module>
ImportError: cannot import name Rect
@stoic marsh your external battery pack is not sharing a ground. Also on a full breadaboard there's a split in the middle of the power rails.
hitting this check https://github.com/adafruit/circuitpython/blame/master/py/runtime.c#L1440
@indigo wedge I'd suspect something simple at first, like the file on CIRCUITPY is missing some pieces due to an incomplete write.
but when I try to do it from REPL it works:
>>> from ui.core.tools.Rect import Rect
>>>
if it's corrupt then usually it's a syntax error not cannot import, i added a print in runtime.c and it's definietely that line
Thank you @tulip sleet mine isn't exacctly like the image. I'm using a small breadboard that does not have the external rails. But I need to check if the ground is common.
if i checkout a commit from before the Micropython merge then it works
@stoic marsh also you have no resistor on the LED, not terrible, but you should have a current-limiting resistor
@indigo wedge if you could bisect that would be great
yeah, problem is i have a custom change to make the MSC larger cause my code doesn't fit in 256KB so i would have to apply that every time i jump in the bisect
@tulip sleet I was trying to get the idea across. I do have a resistor, and the sensor only has + - and output
I'll try to make a minimal example and bisect with that
@stoic marsh ok, so just make sure the grounds are connected together
this is a total blocker for me right now, my code just fails to work :<
gotta go cook
bummer @indigo wedge !
@nickzoic and I discussed this yesterday and came up with the following changes (from his email note about it):
- regularize both 'usocket.socket' and 'lwip.socket' into CPython-compatible 'socket.socket' and socket should become part of the shared-bindings / common-hal split.
- move 'network.WIZNET5K' off into 'wiznet.WIZNET5K'
- Merge 'WIZNET5K.active()' into the constructor and add a deinit() and exit method to make it context-managery.
- Make the SPI bus speed configurable
...
@slender iron revised PR looks good! Just one outstanding q left for me about running through the groups backward when you display them. The group list runs from back (rearmost thing) to front, right? So if run through the list backwards and display them in that order, then won't the front objects get obscured by the back objects? I'm confused.
hey all, how does time.time() know what time it is?
it doesn't
oh?
you set it with struct_time?
what does monotonic, values seem like? i.e. how much does it increase in 24 hrs ?
The rtc module can set the current time, see https://circuitpython.readthedocs.io/en/latest/shared-bindings/rtc/__init__.html
monotonic() is in seconds But it can get somewhat behind due to interrupts, etc. If you really want to know what time it is, an off-board battery-backed clock is the best idea.
@tulip sleet my time resolution is in days , approx.
I can download the time from server, or get it from gps
it's on my adalogger, which is connected to esp32
i just fired up a board and it started at jan 1, 2000 as the default
nice, lol
if you want an accurate timestamp, then asking for external time is best. If you don't want to ask externally, see products 2922, 3028 and 3013, and note their different accuracies.
@tulip sleet thanks, Dan!
yw!
Sorry i haven't tested that build yet. I've been a bit busy
adding more sensors from adafruit to my robot π
It has a ton of pins in a Mega form-factor
This also includes a change to init the stack earlier. It fixes
a crash that occurs if the flash doesn't start correctly and the
original spot isn't reached.
hm, this actually works. Now I have a compact way to assign pins.
"""
pinNames = ['muxa','muxb','muxi','ldac','daccs']
pinList = [board.D2, board.D3, board.D8, board.D9, board.D10]
for pin in range(0, len(pinNames)):
globals()[pinNames[pin]] = DigitalInOut(pinList[pin])
globals()[pinNames[pin]].direction = Direction.OUTPUT
"""
er oops
Looks good! Should I check against schematic? It's not in the usual place.
schem is in MBAdafruitBoards\Development\Dev Boards\Metro M4 Mega
SDA and SCL are PB20 and PB21, according to schematic.
@tacit glade @solar whale heya i modded the hc04 sonar library
it now works on non-pulseio boards like Raspberry pi
@prime flower ^
oh that's a neat trick for detecting pulseio
do we have an official arduino lib? I've been planning to use (https://github.com/ErickSimoes/Ultrasonic) bc it works nicely as well
@tannewt I just got tripped up about ISR support as well by the page below. Is this an old version of the documentation?
One advantage of ISR's over polling (I think) would be to enable sensor reading and peripheral control to happen during REPL or Serial Console sessions. Please correct me if I'm wrong.
https://adafruit-micropython.readthedocs.io/en/latest/docs/reference/isr_rules.html
@prime flower yeah find something, they are all pretty similar
we can write one too if you want something with Adafruit_Sensor compatibility
which isnt a terrible idea
adding an ultrasonic to adafruit_sensor would be great
@indigo wedge hmm that is strange, on Linux it is spot on with 256KB., did you see the current 256 KB got reported larger as well. If you re too worrried, maybe insert a check to skip writing to the wrong address. That may be implemented already somewhere in the internal_flash
for the unused lines , I will remove them later with the qspi PR. Did littet many thing when doing the usb PR back then
hooray, the 4-voice midi key assigner works in cp
if the 8-channel hardware runs in a similar manner, timer callback becomes less of an issue π
just in time to bring to knobcon
@tulip sleet after a bit of thinking, I think we may be able to write an app that erase bootloader on pca10059 and write our own boot + update the ucir to the correct address. Similar to what you told me before (like openwrt/ddwrt to consumer router). Can you open an issue and assign it me, I will check it out later when having time.
β¦ user read ability.
This is a simple change to validate I have the circuitpython workflow correct.
@gentle bronze can't wait for the qspi change, my next board has qspi flash so it's perfect π
yay! getting the JLink connected was a struggle ---- but finally ```
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 4.0.0-alpha-1057-g23b23dd2b-dirty on 2018-09-06; PCA10059 nRF52840 Dongle with nRF52840
@indigo wedge getting it done asap
This is a very nice video that discusses some techniques for saving memory: https://www.youtube.com/watch?v=ZWQ0591PAxM
@prime flower the ultrasonic supplies 'distance'
which all our distance measurement sensors should give ya - approx distance in cm
@meager fog thanks for the hcsr04 update -- I'll dig one out and try it later today.
@solar whale thanks! i dont have a PING sensor handy but i can get it working there too
@meager fog hcsr04 works great on my RPi 3B+
@tulip sleet I think you are confusing the mental model with the implementation for the display code.
The mental model is the painter's algorithm where every layer is painted and the last drawn pixel remains visible.
The implementation has the same effect by running backwards until it finds an opaque pixel and then it stops. It doesn't need to run through the rest of the list then.
@WRadigan That is outdated. The latest docs are here: https://circuitpython.readthedocs.io/en/3.x/
@tulip sleet Just curious if you have tried playing with the RGB LED2 on the nrf52 Dongle, On mine I can only get LED2_R to respond. Note, thay are Active Low - I can blink LED2_R, but LED2_B and LED2_G do not respond. I don't get any errors and I can set/retrieve the value setting, but no response at the LED. ```import board
import digitalio
led1 = digitalio.DigitalInOut(board.LED1)
led1.direction = digitalio.Direction.OUTPUT
led2_r = digitalio.DigitalInOut(board.LED2_R)
led2_r.direction = digitalio.Direction.OUTPUT
led2_g = digitalio.DigitalInOut(board.LED2_G)
led2_g.direction = digitalio.Direction.OUTPUT
led2_b = digitalio.DigitalInOut(board.LED2_B)
led2_b.direction = digitalio.Direction.OUTPUT
This is a follow up on #1155 with the CircuitPython changes.
This shows the flash use in bytes on a Metro M4 build:
| Patch | Flash |
|---|---|
| samd: Make os and time weak modules | 144 |
| samd: Enable collections.OrderedDict | 444 |
| samd: Enable MICROPY_CPYTHON_COMPAT | 752 |
| Make closure and bound method hashable | 0 |
| modsys: exc_info: Add traceback | 0 |
| samd51: E... |
Good catch! I added it to autobuild as well.
Great! Will merge as soon as travis finishes.
@dhalbert I think you are confusing the mental model with the implementation for the display code.
The mental model is the painter's algorithm where every layer is painted and the last drawn pixel remains visible.
The implementation has the same effect by running backwards until it finds an opaque pixel and then it stops. It doesn't need to run through the rest of the list then and nothing is overwritten.
Got it. I didn't look at the loops closely enough.
@solar whale I had trouble with the RGB LED too, and they were all faint or even not visible. But I rewrote the DigitalInOut.c code yesterday to use the built-in open-drain capabilities of the nRF GPIO pins. We can have a true open-drain output instead of simulating it with an input. Haven't had time to test this yet.
This will involve setting up the display constructor to construct and return a singleton. Once its initialized, the supervisor should use it for error messages.
Every object within displayio groups should be able to provide rectangles to redraw for them.
This is particularly helpful for scrolling text output so that the new line only needs to be transferred.
The gameboy uses this technique. Its explained here: https://youtu.be/HyzD8pNlpwI?t=31m43s
Add a shape builtin that stores bounds per row where the palette index should be 1 instead of 0. Python can be used to generate the bounds.
Support text rendering from a font builtin.
The rectangle bounds should be available in Python as well so code can position and size an object based on another.
I've started logging issues with the displayio label: https://github.com/adafruit/circuitpython/labels/displayio
Since this is now in, we should be able to do pieces separately.
Why are you adding this back?
@tulip sleet Thanks - glad it's not just me
Let me know if there is anything you want me to do to help with it.
@solar whale "VDD nRF" on the schematic measures as 1.8V, which explains why the green and blue LEDs don't work. That's the voltage from the internal regulator, and it goes to the + ends of the LEDs. Reading more about it now.
and, in the current setup, HIGH on a GPIO pin is 1.8V, not 3.3V. We need to configure to voltage regulators differently to provide 3.3V outputs
What document are you looking at?
and the datasheet http://infocenter.nordicsemi.com/pdf/nRF52840_PS_v1.0.pdf
trying pca10056 pins now
pca10056 is 3.0v (not 3.3v, hmm)
hmm -- these things are way too configurable.....
yah, not sure if there are some nvm fuses that are different on the two boards, or what. no code that I know of that is different between the two
i need to spend some quality time with the datasheet
msgfmt:
@tulip sleet
make: msgfmt: Command not found
$ cd circuitpython
$ pwd
/home/wa1tnr/blinka/Git/Adafruit/circuitpython
$ make -C mpy-cross
make: Entering directory '/home/wa1tnr/blinka/Git/Adafruit/circuitpython/mpy-cross'
Use make V=1, make V=2 or set BUILD_VERBOSE similarly in your environment to increase build verbosity.
QSTR updated
python3 ../py/makeqstrdata.py build/genhdr/qstrdefs.preprocessed.h > build/genhdr/qstrdefs.enum.h
make: msgfmt: Command not found
../py/py.mk:301: recipe for target 'build/genhdr/en_US.mo' failed
make: *** [build/genhdr/en_US.mo] Error 127
make: Leaving directory '/home/wa1tnr/blinka/Git/Adafruit/circuitpython/mpy-cross'
$ pwd
/home/wa1tnr/blinka/Git/Adafruit/circuitpython
So that import os and import time continues to work if there's no python module with that name. It's a weak alias.
Did the build environment change to require a new python .. module/whatnot?
@timber mango I think you also need to install gettext if you don't have it.
i never had to install gettext explicitly, but yes, that's the dependency
I had to install it on my Mac, not Linux,
I didn't have gettext:
Get:1 http://debian.cc.lehigh.edu/debian stretch/main amd64 gettext amd64 0.19.8.1-2 [1,495 kB]
Thanks!
Hope that helps!
Will report back in a few minutes. :)
That was definitely it. Thank you both!
text data bss dec hex filename
198006 20488 912 219406 3590e mpy-cross
make: Leaving directory '/home/nis/anthrope/Git/Adafruit/circuitpython/mpy-cross'
@tulip sleet FYI - I manged to fry one of my Dongle boards. I think I accidentally shorted jumper SB1 - near the SWD header -- It says not to do that! May damage the SOC. Looks like it is true. I made a real mess of the header. Ended up just tacking wires on the 2nd one. Now I see taht SWDCLK and SWDIO ore on big castellated pads. May be a lot simple to use thme in the future.
sorry to hear - I have succeeded on 2 out of 3 SWD header solderings, but it never works the first time. I tinned the pads and the leads, and I still have to go back and reheat them. I also destroyed the pads on an 832 feather trying to remove a bad header soldering job
Adafruit CircuitPython 4.0.0-alpha-1057-g23b23dd2b on 2018-09-07; Adafruit Metro M4 Express with samd51j19
>>>
Thanks again!
@timber mango Congratulations! Glad to help!
I use pogo pins inserted into dual female jumpers (One solid connector) and wedge that underneath the Feather mounted on standoffs bolted to perfboard -- makes a good solid SWD connection that way (I use the pointy ended pogos)
I have not tried the pogo pins yet -- I have a few and they look like a good way to go.
basically the 'elbow' in the jumper wires near the dupont plastic jumper shroud acts as another spring.
There's about almost 0.25 inch travel on the pogo springs.
Then just stabilize the dual jumper wire pair, mechanically.
Also: I use the extra long male headers to fix the perfboard to the breadboard. ;) Just bend them over 90 degrees (alternating). Really really strong mount. One row of 16 is plenty. ;)
Sounds like a good setup!
I also take a very sharp push-pin and make a high-reliefe 'dimple' in the SWD pads, to capture the pointy end of the pogo. ;)
thanks - the pictures help me understand the setup better! Nice.
It worked out and wasn't the first thing I tried. ;)
My Segger J-Link EDU won't talk (effectively) to Feather M4 Express; I read somewhere I may need a firmware update to the Segger to get it to go. Nevertheless there was enough positive response to know it was wired correctly (I believe). One of the LED's corresponded exactly with what was done through the user interface when talking to the Segger (Maybe in GDB?)
@timber mango if you do end up upgrading your jlink edu to work better with the m4 id like to know your findings
@tawny creek will do! I may not remember who asked though. ;)
I really should get to it but it's not that important at the moment. My theory is that my flash was unlocked ('somehow') as the M4 target behaves as if it is alive, yet I cannot access the boot sequence.
(LED feedback is very consistent so I think the LED is still under program control)
I was running a bare metal atmel start 'forth' like program at the time and did nothing awful except read/wrote to the wrong memory map address (randomly).
No amount of shouting wake up poly! wake up, polly parrot at it does any good at all.
This is pretty new to have a problem:
$ JLinkExe
SEGGER J-Link Commander V6.34b (Compiled Aug 13 2018 16:39:17)
DLL version V6.34b, compiled Aug 13 2018 16:38:47
i've been getting mixed results lately with Win10/Atmel Studio lately. i upgraded jlink to latest last night...didn't help.
Oh that's software -- oops. Not firmware. ;)
Somersoft did they force .EXE or is this a Linux-capable upgrade method for the J-Link firmware.
The javascrap they run on their website makes it impossible to navigate
but, i didn't have jlink firmware issues prior to that. that i know of, at least. π
;)
That's good because that implies this is a Hail Mary pass to try to win when it's not happenin'.
Section 17 suggests the Segger will update automagically on its own.
UM08001_JLink.pdf 17.5.1 Firmware Update
Yeah the comment I read may've been written (did not check!) prior to Segger deciding to do this for us automatically.
BUT there's a section on reset strategies I haven't looked at, in the user manual. And I don't recall establishing a ground reference to the Feather M4 -- just the two pads underneath.
My bad. I have six wires hooked up to the breakout. ;) They must do something!
Yeah there's RESET and all kinds of stuff.
I seem to be good on the hardware side of my setup (using Feather M0 Express, instead, as it is working):
Reading symbols from build-feather_m0_express/firmware.elf...(no debugging symbols found)...done.
(gdb) target extended-remote :2331
Remote debugging using :2331
0x000002e8 in ?? ()
(gdb) load
Loading section .text, size 0x37560 lma 0x2000
Loading section .ARM.exidx, size 0x8 lma 0x39560
Loading section .data, size 0x400 lma 0x39568
Start address 0x2000, load size 227688
Transfer rate: 37058 KB/sec, 13393 bytes/write.
(gdb)
Yeah I just ran CircuitPython by the Segger J-Link tether, so the hardware's definitely right. ;)
@tulip sleet @slender iron Bisecting led me here:
498fec64e increase new dynamic stack size to a comfortable value for now // first bad
dfa2581ff Merge pull request #1057 from tannewt/flexible_heap
4b247eacd (tannewt/flexible_heap) Add todo for handling improper free.
5704bc8c9 Share memory.c and a bit of polish.
88ae7a9b2 Merge pull request #1082 from tannewt/no_pin_qstr // last good
For the 3 middle commits my code doesn't run, the board boots right after flash but when I copy the test code and reset, I get no REPL. I used same code to test all 5 commits so don't think it's the code's problem.
@indigo wedge you have a summary issue for it? I don't have context
./lib/mp-readline/readline.o
Scrollback in the circuitpython REPL From this?
(command line history)
Scott, it's about the issue I mentioned yesterday, I have a code sample where a import statement fails for some reason
can you file an issue for it?
You will find that ST7735 doesn't let you do that β any offsets you set only take effect for newly drawn pixels, and not the ones that are already there. The ILI9341 lets you scroll, but only in one axis IIRC.
The nRF52840 can be set to supply different voltages on its GPIO pins. If the chip is used in "high voltage" mode (so-called due to how the internal regulators are used and how the VDD and VDDH pins are connected), then the UICR->REGOUT0 register can be used to vary the voltage on the GPIO pins.
The PCA10059 dongle is set up to use "high voltage mode"
If you erase the NVM (say with some firmware erase command), then the UICR->REGOUT0 register is set to all 1's, and it uses the defau...
OK - i did notice the high voltage on my PCA DK was a tad lower than expected, my neopixels were not happy about it.
doing a bit of testbench, is the speed Ok
clock 32 Mhz

clock 8 Mhz

Nice! the set *0x10001304 = 5 worked ! -- nice blinking RGB now!
Connecting the JLink to the SWDCLK SWDIIO VDDOUT GND pads worked! No need for the header or tacking wires.
@dhalbert FWYi after setting this register I now see that the JLink reports the target voltage as 3.29V rathere than 1.78V as it did before the change. I have my JLink connected to the VDDOut pad but from the Schematic, this should be the VDDnRF which is pin 1 on the SWD header.
before setting register
jerryneedell@Ubuntu-Macmini:~/projects/nrf52_dongle$ JLinkGDBServer -if SWD -device NRF52832_XXAA
SEGGER J-Link GDB Server V6.30h Command Line Version
JLinkARM.dll V6.30h (DLL com...
Version 2
- Only enable on M4
- Increase stack size to 8k on M4. If forgot about this one, I was setting it with set_next_stack_limit in my script.
also interesting, - I did not notice that the JLink identified the Dongle as a n NRF52832_XXAA -- it a all worked OK!
hmm -- that was shortlived - I may have shorted something, but I appear to have fried another Dongle. I now see only .5V on VDDOut and the board is non functional. It's possible I shorted VDDOut to GND when connecting the JLink. Not sure if this would kill it. Just wanted to pass on a waring. Luckily theses boards are only $10. I have one more, but want to tread carefully before I kill another one! Should have a few more soon. Mouser is backorder, Symmetry claims to have them....
Took a chance with my remaining dongle -- Flashed the bootloader and set the Register
for 3.3V GPIO then loaded CP 4.0 master.
All seems to be working well.
Noted that JLink now still sees the target voltage as 1.8V but measuring VDDOut shows 3.3V
Hopefully that makes sense...
jerryneedell@Ubuntu-Macmini:~/projects/adafruit_github/Adafruit_nRF52_Bootloader$ JLinkGDBServer -if SWD -device NRF52840_XXAA
SEGGER J-Link GDB Server V6.30h Command Line Version
JLinkARM.dll V6.30h (...
and to confirm taht I am still confused, but it is still working -- now Jlink reports the 3.3V target
jerryneedell@Ubuntu-Macmini:~/projects/nrf52_dongle$ JLinkExe
SEGGER J-Link Commander V6.30h (Compiled Mar 16 2018 18:04:43)
DLL version V6.30h, compiled Mar 16 2018 18:04:35
Connecting to J-Link via USB...O.K.
Firmware: J-Link V10 compiled Mar 2 2018 17:07:17
Hardware version: V10.10
S/N: 260101649
License(s): FlashBP, GDB
OEM: SEGGER-EDU
VTref = 3.350V
Type "connect" ...
any thoughts on an fpga cp board?
@marble hornet FPGA has always interested me, but i haven't dug into them enough. are there C compilers for FPGA? i thought they were primarily Verilog...
Like I mentioned on Discord, after updating my code from somewhere around July to current master, I ran into a problem where a import was failing with "ImportError: cannot import name Xyz". After a lot of bisecting I managed to identify that this problem started with #1057
While I didn't dive too deep into what exactly is happening, I managed to fix the issue by increasing the CIRCUITPY_DEFAULT_STACK_SIZE value from 4K to 8K.
The read speed is similar to cpx test, but the write speed is not that great. I will do a bit more tweaks to see if it could improve more.

In 3.0 and SAMD21, the default stack is 12k, including a 1k guard region. So yeah, that just sounds too low -- we should increase it. @tannewt?
I thought Scott and I discussed this in a PR but I can't find it.
But it's still odd - should give a more straightforward error.
The write code -might- need work. It seems slow on SAMD51 (writing a large file takes a long time), and maybe there's a little bug somewhere.
Note : it's already board.VOLTAGE_MONITOR, at least on Feather M4 Express.
@marble hornet here is a short hackaday article on C-to-HDL. There are much longer descriptions and pro/cons available. https://hackaday.com/2015/12/17/xilinx-fpgas-in-c-for-free/
@slender iron @slender iron do you have a capacitor on the reset line?
@marble hornet fpga cp board would be p sweet
just ordered a digilent nexys 4 ddr for a class I'm taking, their academic discount is pretty steep considering the Artix 7 is not inexpensive
@prime flower is that an fpga based board ?
https://store.digilentinc.com/nexys-4-ddr-artix-7-fpga-trainer-board-recommended-for-ece-curriculum/
most universities use it/suggest it now
I spent a lot of time probing on the board, and finally read the documentation as well. The PCA10056 DK board deliberately uses a 3V (not 3.3V) regulator (U11) to power VDD on the nRF52840. So the output pin voltages are going to be 3.0V instead of 3.3V.
See http://infocenter.nordicsemi.com/pdf/nRF52840_DK_User_Guide_v1.2.pdf
:slightly_frowning_face:
Noticed that you were considering a FPGA version of CP. How about a version that runs under RISC 5, that way you have a free ip for the FPGA being considered.
@carmine basin Discord uses markdown for code, check out https://gist.github.com/ringmatthew/9f7bbfd102003963f9be7dbcf7d40e51#code-blocks
@inland tusk idk, I haven;t done any work with RISCV, tho that'd fit CP's Open Source
@pastel panther Somebody mention FPGA's earlier in this chat. thought that itt would be a good combonation..
ah; RISCV is a pretty good idea. I know Scott had previously made both a RISCV and ICE40 feather
I'm pulling my hair out trying to get the hardware UART working on the ItsyBitsy M0 Express. The ASCII seems to get garbled in transmission. I'm using a ATEN USB to Serial Bridge on the PC side, and the pattern is below. #Character Sent --> Character Recieved:
01100001 a --> O --> 01001111
01100010 b --> '
01100011 c --> Γ (b'\xce') --> '11001110'
01100100 d --> (b'\x13') --> ' 10011'
01100101 e --> Γ (b'\xcd')
01100110 f --> f
01100111 g --> L
01101000 h --> (b'\t')
Also, the ItsiBitsy won't start properly if the RX line of the hardware UART is connected to the host computer. Is there a workaround to this, or am I just not doing it right. Right now the only pins connected to anything on the ItsiBitsy are TX, RX, and GND.
@tulip sleet I measured the VDD voltage on my fresh nrf52840 Dongle and "I think" it was 3.3V but it could have been 3.0 - I was just checking to make sure it was not 1.8.
the dongle is 3.3v; the pca10056 is 3.0v
OK - thanks for confirming.
the dongle uses an internal regulator on the nrf52840 chip; the pca10056 uses an off-chip regulator
ah -- do you know what the feather nrf52840 will use?
ok so 3.3 should be good for the Dongle
@tulip sleet last week you mentioned a "long-lived UART bug"... Was that related to the hardware UART or the USBish Serial Console? Also: How do I know if the firmware that I'm currently running is subject to that bug?
@tawdry wyvern the UART bug is hw UART and has to do with the buffer getting moved. Are you using 3.0.0 or 3.0.1? It's fixed in 3.0.1.
I came up with a new way to do the JLink - much safer than alligator clips and easier than a header
i bought those little things, I think, but haven't used them yet. I was going to solder headers on my other one. With the SWD on the back, it's not breadboardable, as you know π¦
I've used the little gizmos with mixed success, but this time I soldered them in and they work fine. Then the 2 header pins fit nicely on VDDout and GND
I ordered more headers, but last time was pretty discouraging.
you mean it was hard to solder them to the castellated indents?
no, that was easy. the Header was hard.
i mean soldering the header to the indents
@tulip sleet Good question. I have 3.0.1 downloaded, but I'm not positive that the bootloader ran correctly. If I get to the ITSYBOOT file system, is there a way to tell?
just look at the prompt message when you open the repl. it has the version
the 2 header pins worked fine.. I was refering to my SWD header fiiasco
or just copy 3.0.1 to ITSYBOOT and be done with it
@solar whale
oh yes, that was painful
i was going to solder a strip header to the castellated pins
I did one on a feathrr52832 awhile ago and it went fine -- I was over confident this time!
i wonder if hot air would be better
probably, but I don't have it.
Ahhhhhh Thanks @tulip sleet ! It's an old board running 2.2.3. I'll see if 3.0.1 makes it any better.
ooh - I just checked and it looks like the SWDIO and SWDCLK are just offset by one breadboard row fro the rest of the pins
@tawdry wyvern 2.2.3 should be OK for UART, but upgrade anyway for many other fixes
It looks like the Aten settings might be all wrong: almost looks like it's reversing the bits (!!), and make sure it's set to 8 bits no parity 1 stop bit (8N1), which is completely the standard these days
on second look, not - I don't thon the 2 sides of the Dongle are breadboard spaced. π¦
@solar whale as long as its 0.1" and not some random number
each side look like 0.1 but the two sides don't seem to be able to span the breadboard gap properly
it's close may be ok
it seems ok - setting up for soldering
ok, soldered. I soldered from the top and then removed and reheated on the side to get the solder to flow all the way down the side
Nice - great idea. When I get my next ones I'll do it this way!
still blinks when I plug it in - stops holding breath
@tulip sleet The bootloader appeared to run correctly (per the description at the page below). The end result was: 1: A blinking board (green and yellow) 2: A COM port in the Device Manager "Adafruit ItsyBitsy M0 Express CircuitPython (8012:00) (COM11) " 3: But no CIRCUITPY drive afterwards. π¦
I can still get to the bootloader with a doubleclick (and have tried repeating the process), but gotten the same result.
Try putting 2.3.1 on the board instead, then copy off everything from CIRCUITPY. Then install 3.0.1, and in the REPL, do
import storage
storage.erase_filesystem()
Then put back what you saved
this is win7?
Correct
@solar whale I'll need a connection to the RESET pad too, right? I'm using the SWD breakout
Hmm. To load bootloader I only needed SWDIO SWDCLK VDD GND
I have not tried using it to run code
Oddness. π I can put adafruit-circuitpython-itsybitsy_m0-2.3.1.uf2 on this board, but neither adafruit-circuitpython-itsybitsy_m0_express-3.0.1.uf2 nor adafruit-circuitpython-itsybitsy_m0_express-3.0.0.uf2 appear to load successfully. If this board is from May 2018, have there been any hardware changes that might cause a problem?
after you put 3.0.1 back and did the erase_filesystem(), CIRCUITPY should reappear
this is probably a software version issue, not hw
After I try to put 3.0.1 back on, I don't get the CIRCUITPY filesystem at all. π¦
I only get a CIRCUITPY when I use the 2.3.1 UF2.
no, but I want you to go into the REPL (via putty or tera term or mu) and type the two lines above
that will erase and re-create CIRCUITPY
Sorry to be dense here. I did erase the filesystem using the two lines above, but I was only able to do that in 2.3.1. (Sorry if I mis-interpreted your instructions.)
ok, so you're saying you couldn't get to the REPL when 3.0.1 was loaded?
just because there's no CIRCUITPY doesn't mean circuitpython isn't running.
Whoops... I'm sorry for missing that. I hadn't considered the posability that REPL would work if I didn't have a CIRCUITPY. (stupid presumptions bite).
I've got a 3.0.1 REPL open and have run: <code>import storage storage.erase_filesystem()<\code>
The board ends up with a green blinky light, but no CIRCUITPY. Also, the COM port seems to be un-responsive until I reset the board.
@tawdry wyvern sorry i was eating dinner
are you running AIDA64 or Kaspersky antivirus?
ay! you got it working
Hi Dan. Don't apologize, I appreciate the help. And yes, I'm running Kaspersky.
try disabling kaspersky completely and unplugging and replugging the board with 3.0.1
@prime flower If i have a 4 lines of code do I first then copy and paste all (at one time) then and hit enter?
@prime flower the first step was to enter " " and the last step was to enter " " .
I have a python question. I'm practicing python... The attached program I wrote, displays the test vertically (text, next line, text next....). How do I get it to display the text horizontally (on one line)?
@carmine basin use three backticks:
```
code
```
code
@raven canopy Thank you .
@tulip sleet Ok. I'll try that. I tested out my code in REPL in 3.0.1 and saw the same behavior so I don't think the UART bug is the problem right now.
And you're right, it seems like the bits are inverted. I've got it printing out characters [A-z] and the receiving terminal prints out some jibberish with a backwards alphabet in between e.g. [k%JI$HG#FE"C!B....].
we've seen this "disappearing CIRCUITPY on upgrade to 3.x" before, but I usually it has come back after reformatting. I'll look up the kaspersky thing in the forusm
Thanks for all the help!
yes, that is really weird - the backwards part, so something odd about the USB-serial settings, I think.
yw!
I've got some CP2104 's coming next week, maybe that will save some of the frustration.
@carmine basin to answer your question, for that particular case, you could do:
if print_vertical:
for x in "Mississippi":
print(x)
elif not print_vertical:
print_string = ""
for x in "Mississippi":
print_string += x
print(print_string)
although, you could drop the for... and just do print("Mississippi").
and obviously, you'll need to handle the conditional (print_vertical = True/False) somehow.
@pulsar ferry Ok. Thank you.
@carmine basin you're welcome. there are other ways to handle this, but can be application/purpose dependent.
@pulsar ferry ok. thanks for the info.
Please wait with this, I'm having problems with the workaround for setting properties on functions.
Making bound method hashable isn't working like I thought it would.
What is the easiest way to recover a CPX when your code.py is running too hard to let even the drive mount work....
(and can't seem to get into REPL)
Ctrl-C isn't getting it done either
Ahhh ... found the fairly obscure hold-down-both buttons here:
https://github.com/adafruit/circuitpython/issues/990
Works!
I'm interested in working on circuit playground support for rust, is this the closest channel to discuss that in?
possible bug, I don't see d11 defined in https://github.com/adafruit/circuitpython/blob/master/ports/atmel-samd/boards/circuitplayground_express/pins.c
oh, I see, It's hiding as MP_QSTR_SPEAKER_ENABLE
@tulip sleet Did you find it necessary to connect RESET for the JLink to the Dongle? I hope not , since it does not appear to be avaialble on a pad...
@tulip sleet I think it is not needed -- see section 5.8.2 of https://cdn-shop.adafruit.com/product-files/2209/UM08001_JLink.pdf
or better -- section 6.9.2 of the latest version of the document from https://www.segger.com/downloads/jlink/
SEGGER - The Embedded Experts
Download the latest SEGGER trial versions, eval packages and user manuals!
And I was able to issue a RESET to the board via my JLink without RESET connected - using Ozone to look at code execution - seems to work OK.
C=>Python described. Nick Moore's presentation on the esp32 port includes a newbie's intro on how the C gets turned into Python. The slideset below seems to cover everything.
Slides: http://yowconference.com.au/slides/yowconnected2017/Moore-EasyIoTWithMicroPythonESPSoCs.pdf
Nick did a few presentations and didn't always go into the C=>Python process. This presentation includes that part of the process: https://www.youtube.com/watch?v=-MrqCmq3Z5k&feature=youtu.be&t=18m4s
@solar whale i've had zero trouble without the reset line. I guess there are plenty of ways to reset via only SWD. I could imagine you'd want the reset line connected if you were debugging flaky hardware that tended to hang up even on SWD.
@exotic pumice we like rust but have no plans wrt circuitpython. What would you think of using rust for? As an alternative language for writing some of the firmware code? We use gcc, not clang/llvm to compile the firmware
I'd like to work with the rust-embedded team to add support for some boards
so that they can be programmed in Rust, in addition to C, C++, Python, and whatever else (JS?)
I think it's a good intro to embedded for me
there's a tracking issue here https://github.com/rust-embedded/wg/issues/61
I wasn't thinking of adding rust to circuit python, if that's what you thought
that would probably just complicate the build process
sorry if this is the wrong channel, there's no circuitrust lol
oh, i misread "circuit playground" as "circuit python". samd21 support would be very interesting. It's just another M0+ from the basic compiler point of view. The tricky stuff is library support for clock setup, peripherals, etc. #help-with-projects or #general-tech would be ok channels, but they are very full, and us embedded developers don't spend as much time in them
is chip-specific support the point of the wg project?
the wg stands for working group, it's the committee of people working on embedded rust
so does "embedded" in this case mean basic support for the different ARM variants (M0+, M4, etc.), or does it also mean chip-specific support?
both
is there m0+ support already?
yes
samd21 I think too
I just tacked on circuit playground to this crate https://github.com/wez/atsamd21-rs
what is the model for chip support libraries? is there an attempt at a common API across different manufacturers? ... looking at that link, it looks like you're trying to create the equivalent of CMSIS support for the various chips (not higher-level libs yet?)
I'm not sure what CMSIS means,
so far I've just defined the pins pretty much
but I'd like to do things like neopixel drivers too
CMSIS is .h files that define all the periph register addresses, bitfields, etc. Basic named access to all the chip-specific stuff
yeah, that's basically what I've got so far
are there higher level libs like the arduino libs for I2C, SPI, UART, etc.?
but CMSIS is per-chip, not per board
oh, that's probably the svd then
yeah, exactly. I think the CMSIS files are (or could be generated) from svd
are you thinking of supporting uf2 or arduino style bootloaders, or do you already?
the spi and i2c seems to be here https://github.com/wez/atsamd21-rs/tree/master/hal/src/sercom
rust for m0/m4/etc would be awesome
the readme suggests using some of the arduino toolchain to load your code onto the boards, not sure if that's what you mean
yes
it would be cool to get it integrated with cargo though
also most of our cpy boards use the UF2 bootloader, which as you know presents as a USB drive, so no upload program is necessary. There's a conversion program from .bin to .uf2
cool
so whatever you come up with would be interesting, and of course tutorials and projects. our own emphasis is always on making things easier, but if rust coding is an improvement over the current C (and a little C++) toolchains and libraries, then the professional users woudl be interested too.
uf2 is pretty neet
I've been interested in rust for a while as an alternative to C but my concern has always been how quickly the community would be able to replicate the libraries already available in C
there's lots of cool stuff out there, and where there isn't you can bind to C via FFI
though my understanding is that rust has a very enthusiastic community
yep
On a CPX I've got a .mpy file that is zero length, but I can't get rid of it, even in safe mode. Thoughts?
There is a tool for nuking the storage of a CP device; let me see if I can find it
does it load the code as expected?
It does now π The .mpy file was working, but I was out of memory, I made it a frozen lib but then didn't delete the .mpy. Oops. Wend to delete the .mpy, and CP got pig-headed
yea, it can be like that at times
It looks like .mpy files seem to get kinda locked at boot sometimes? I had another one which I was using, couldn't even copy it off the device
that one works fine
worked fine anyway
I have a habit of writing a .py, then making it a .mpy 'cause I'm out of memory, then freezing it because I'm out of memory again, as I build this house of cards
and it can be hard to keep track of which one CP is actually using. It looks like it prefers the .py?
TBH I couldn't tell you without looking at the code; would you like me to?
@arctic heron it does prefer the .py over the .mpy, so rename the .py or remove it
@tulip sleet Thanks! Do you happen to know how frozen modules fit in there? My guess is they are the lowest on the pole
they are determined by sys.path. There is a fake directory .frozen, which means to look for frozen ones. RIght now it is last on sys.path, but you can prepend it to the front to favor frozen modules. The cpx library does this: https://github.com/adafruit/Adafruit_CircuitPython_CircuitPlayground/blob/master/adafruit_circuitplayground/express.py#L41
It looks like (casual observation) -- 4.0.1 at least -- that if an .mpy file doesn't fit CP just kinda locks up (no memory allocation error, you need to safe boot). Not a newbie user path, so not a big deal. Or I could be wrong.
@tulip sleet Oh, very clever, it fits in kinda proper like. Very nice
i'd consider that a bug, especially if it's a regression from 3.x. Please file an issue.
Ok, I'll try to make something reproducible. I don't know if it is a regression from 3, I didn't use 3 much because I need a custom build so I just hopped on the tip π At this rate, though, I'm gonna have to bit the shipping bullet and buy an itsy-bitsy M4 to develop this app on (which I'll probably freeze and put back into an M0 at the end); easier then fighting memory while in dev
Thanks for the help @pastel panther and @tulip sleet
When CircuitPython starts on a Mac and presents an HID keyboard device, MacOS brings up a the Keyboard Setup Assistant saying the keyboard can't be identified. After a few times, it seems to stop asking. But it would be nice to prevent this from happening at all. Investigate whether we can set something in the keyboard descriptor that prevents this.
How do I know which version of Python the Trinket is running?
@rustic nymph there should be a boot_out.txt file on the CIRCUITPY drive when plugged into a USB port
if you open it in a text editor it will say which version of CPY is installed
Its blank?
have you used the REPL yet?
Ive done it before with this board but not this computer
There are some instructions here if you need to figure it out for a new computer:
https://learn.adafruit.com/welcome-to-circuitpython/the-repl
when you open a REPL one of the first lines will tell you the version installed
Is this the only file I need from a library? https://i.imgur.com/Ez1gIAS.png
I believe so
Thank you
I find it best to put the files in the CIRCUITPY drive, then open a REPL to test the code bits that I'll need to use the library. Once I have the basics figured out, I write a code.py with the stuff I learned/tested on the REPL
When I try "import pulseio" I get "ImportError: no module named 'pulseio'"
and upgrading circuitpython fixed that
strange; normally an import error when you know the file is there is due to a path issue; glad you were able to fix it
Ah python is a struggle
it can be, but it can also be pretty great at getting things done
the startup costs for any development environment can always be frustrating but I try to think of it as an investment in the future
- Use native GPIO capabilities in
common-hal/digitalio/DigitalInOut.cinstead of simulating open drain outputs with inputs. - Make sure GPIO voltage is 3.3V. It will be 1.8V if
UICR->REGOUT0has been cleared. - Some refactoring of
board_init()into other places.
Well I got it to write power in a text box when I hit the power button a remote so thats a start
nice
@rustic nymph if you're getting a pulseio import error on a Trinket, I imagine you're on an older 2.x version. pulseio was left out of the firmware on non-express boards due to storage size. the last 2.x version, and all 3.x versions should have pulseio on non-express builds.
@raven canopy is the machine code getting tighter? is that what's enabling the inclusions?
its a combination of things. memory [block] management was improved and qstr compression, are a couple of the larger improvements that i remember.
Any idea why I get two pulses when pushing a button? [9005, 2217, 581]
[8996, 4426, 592, 525, 589, 529, 595, 522, 592, 1632, 596, 522, 592, 525, 600, 518, 596, 522, 592, 1632, 627, 1597, 620, 1604, 624, 493, 621, 1603, 595, 1629, 619, 1605, 624, 1603, 625, 492, 622, 1602, 626, 492, 621, 1603, 626, 1597, 620, 498, 627, 491, 623, 494, 620, 1604, 623, 495, 619, 1604, 624, 494, 620, 497, 628, 1596, 621, 1603, 626, 1600, 628]
@rustic nymph are you setting the maxlen argument when you call PulseIn? it defaults to 2 readings if you don't. https://circuitpython.readthedocs.io/en/3.x/shared-bindings/pulseio/PulseIn.html#pulseio.PulseIn
Its using 200 from the example here - https://learn.adafruit.com/ir-sensor/circuitpython
With maxlen at 0 I get [0]
[9023, 4395, 622, 495, 619, 498, 626, 491, 623, 1600, 627, 491, 623, 494, 620, 497, 627, 490, 623, 1600, 628, 1594, 623, 1600, 627, 490, 624, 1598, 619, 1604, 624, 1599, 598, 1628, 589, 1633, 595, 1628, 589, 528, 596, 1627, 591, 1632, 595, 522, 592, 525, 599, 518, 596, 521, 593, 524, 630, 1593, 594, 522, 592, 526, 598, 1624, 593, 1630, 598, 1627, 590]
looks like maybe a repeat code
maybe I need to try a different remote, this is with an old sparkfun one
even with a tv remote I get a group of 3 and then the big group
no ETA!
we will serve no wine before its time -Paul Masson
in what folder do i put the BIN file in and i downloaded Microsoft makecode from the Microsoft store
unittest uses decorators to add properties to functions about skipping and if it's expected to fail.
MicroPython doesn't support properties on functions, so the work around is to use a dictionary with the function object as the key.
However I'm getting different function objects for the same function depending on which scope I'm in:
Adafruit CircuitPython p...
Well, the "." operator is magical for functions. If called on a class, it will return a wrap the function in an instance of a class method, so that it can remember from which class you took it. If called on an instance, it will wrap the function in an instance bound method, so that it can keep a reference to the "self".
reset_input_buffer() would also be great, flush input buffer, great for getting clean packets :)
I'm getting memory allocation failed on this code on line 4 - https://pastebin.com/JZiZ0jrY
Any ideas?
make sure you have the mpy installed, not the py
I actually had both in there but the mpy was for 2.0 and I still dont know what im doing with python
anyone able to help with some crude python?
I might be able to
led.value = False
print(FN)
FN += 1
print(FN)
time.sleep(0.25)
led.value = True
TEST = FN + ".bmp"
print(TEST)
#condition: raise label() # goto label```
so let me explain my mess
fn starts as 1
it increases if you hit the button
i then need to make "test" equal the new value of fn + .bmp
so hit the button and i want 2.bmp to be stored as TEST
(with some statements to verify for testing?)
sorry nont understanding what you mean
I'm assuming those print statements are for you to test/verify that it's working as you expect
ahh yes correct
but i keep getting errors
TypeError: unsupported types for add: 'int', 'str'
that's the TEST = FN + ".bmp" probably
str(FN)
TEST = str(FN) + ".bmp"
you can cast the int to a string
you have to cast
man, ty. i've been fighting that for an hour
cheers
ok, now i have one more issue. i need a goto. i know python doesn't really do goto and they are really hated, but i just need to make a jump
gotos can usually be replaced with while loops
what are you using it for? There is almost certainly a way to do what you want without it
for lack of elegance, i'm trying to cludge together a way to use the HalloWing Light Paintstick with more than one file name on the go
if you go here https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/master/Light_Paintstick_HalloWing/light_paintstick_cpx.py
i need to jump after my crap code back to line 168 so the my new "filename" gets reloaded and everything continues
I'd probably iterate over a list of file names if I were you
i guess let me explain the thoughts
i can't easily edit the code on the go. but i can make just put new files on the cpx
so let's say i have filenames 1-20 on the cpx
i've added the crap i've written at the bottom that increases the filenames
os.listdir
you can use that to get a list of files that you can then loop through
so everytime i hit A3 it will change the filename now to the next number 2.bmp, etc. but then i need to jump back to line 168 so it reloads, plus allows me to keep going up in filenames or change speed
you'll probably say something like os.listdir('image_files/')
that's over my head sorry. that would require alot more than my understanding
We'll help you figure it out. You're already pretty far along
if i can just go back to line 168 it will reload the new filename and then everything keeps running
Can you try something? Instead of changing the code in load_bmp, let's instead change the name of the file that it's loading
that way load_bmp can stay focused on doing its job of loading bmps
i'm game to try anything to make this work
that's the spirit
start by commenting out your code and putting the following before the call to load_bmp, around line 168:
FILES= ['1.bmp']
CURRENT_FILENAME=FILES[0]
that should load your 1.bmp file
(we're going backwards to go forwards)
ok, and i'm adding before like 89 not 169,. i see it loads much earlier
the code doesn't actually execute anything until line 170
?
i get outputs in the console corresponding with 89
'''Loading 1.bmp
File opened
WxH: (60,30)
Image format OK, reading data...
Loaded OK!
Mem free: 6368'''
CPython returns the same object:
>>> class A:
... def a(self):
... pass
... print(a)
...
<function A.a at 0xb6926108>
>>> A.a
<function A.a at 0xb6926108>
>>>
Do you know where MicroPython does this wrapping?
I have a solution for the bound method case, enabling MICROPY_PY_FUNCTION_ATTRS and 3 lines of code for __func__:
=== class A:
=== def a(self):
=== pass
===
>>> A.a
<function a at 0x2002d780>
>>> A().a.__func__
<functi...
there are some statements before the fn definitions
np, it confused me as well
either way, @velvet yarrow did the code I mention work?
it would help if there was a
if __name__ == "__main__": or w/e it is
true, but let's keep it simple for now
it still runs fine, it loads 1.bmp
ok, now change the FILENAMES definition to
FILES= ['1.bmp', '2.bmp, '3.bmp']
as a first step
SyntaxError: invalid syntax
sorry, it's missing a closing quote on the 2.bmp
fixed, loaded 1.bmp
do you understand what we've done so far?
i don't sorry
no worries, this is how we learn!
what we did is define an array called FILES that will hold all the file names that we will want to loop through
is this an array? we're telling it we are starting at 1.bmp and we will step through to 2.bmp and so on for a trigger?
aha, i was close π
yes!
so now, instead of using FN directly, we're going to use it to choose which file in FILES to use
one small change we'll need to do is to have FN start at 0, because that's how arrays like to count; 0 is the first item, 1 is the second, etc.
yup
well i mean define a trigger
yea; later in the file, around 188 we have a loop going where we can look for a button press like you were doing and increment FN
(as an aside, I would personally use a more descriptive filename than FN. Something like FILE_INDEX)
ah well line numbers are difficult when we're probaby not looking at the same thing
filename is what the prexisting code is looking for
ahhhhh.
we'll have to move COLUMNS = load_bmp(FILENAME) down into the loop so it can be re-evaluated
i defined FN=1 up above
same with FILENAME=FILE[FN] or whatever
so something like this?
ok so maybe first i change
CURRENT_FILENAME=FILES[0]```
to
CURRENT_FILENAME=FILENAME[0]```
to match all the existing code that is looking for "FILENAME" ??
that won't work because it's expecting FILENAME to just be one value, not 3
ah so maybe FILES=FILENAME?
not quite
FILES = ['1.bmp', '2.bmp', '3.bmp']
FILENAME = FILES[FN]
ok, put that at line 35 and commented out all those names above
so now we just need a trigger to move the array up one and then to trigger the code to rerun the parts to load the new filename?
led.value = False
trigger array to move up one
print(FILENAME)
time.sleep(0.25)
led.value = True
run code to reload with new filename```
you're going to want to structure it (broadly) like so:
imports up here
constants and non-changing things here
functions here like load_bmp
while True:
looping stuff here;
we're never leaving this loop
read a button to change the value of FN
new_filename = files[FN]
COLUMNS = load_bmp(new_filename)
do stuff with columns
so i have to move it completely around?
you can have the constants and what not right above the while True, but I would have everything at that level together
it will make it easier to keep track of; you can even delimit the different sections of code with comments like
######## this section is all function definitions ########
functions here
constants and initializations here
it will work fine spread out but in the long term it might be more confusing
in the end it's up to you how you want to organize it, but having the different sections clear will help keep things organized
HI, this is a support question. Please ask it in https://forums.adafruit.com/viewforum.php?f=60, assuming it's about CircuitPython. Also look for the Learn Guide for your particular board in https://learn.adafruit.com.
so since the bmp loading is outside a loop i have to put it in a loop and have the existing loops further in so to speak?
this is getting over my head unfortuantely
yes! it's under your head! You just figured out yourself what I was just typeing up
there are a few key lines that are only evaluated once in the original version that you'll want to evaluate repeatedly in your version so that you can change how they evaluate
so instead of
#function definitions
COLUMNS = load_bmp(FILENAME)
#more stuff
while True:
#do stuff with columns
you'll want do something more like
#function definitions
#more stuff
while True:
if (button was pressed)
file_index = file_index +=1
CURRENT_FILENAME = FILES[file_index]
COLUMNS = load_bmp(CURRENT_FILENAME)
#do stuff with columns
that's a bit psudo-codey but I think you get it
and don't forget
if (file_index >= len(FILES)):
file_index = 0
so you don't go past the boundary
yup
@velvet yarrow sorry I just re-read what you wrote earlier; You don't need to put the bmp loading in another outer loop, just in the main loop
so now i've really gotten it broken
so i'm working off of the original code, removed all my goofy variables
i've removed all the FILENAME= at the top (lines 17-34) and replaced them with
FILENAME = [FILES]```
but now it won't even load
that's not quite right
you can leave the FILES= but FILENAME will need to be defined/evaluated in the lower while True: loop
when you say FILENAME=[FILES] you're putting an array in a array
did you see my psudo-code above?
whats a good way to learn python in general?
?? but it loads the first filename before the loop even starts?
i thought i had to define the array at the top
@rustic nymph I'm a fan of doing what @velvet yarrow is doing; finding code that works and then modifying it to do what you want to do
@velvet yarrow you should define FILES outside of the loop but define FILENAME inside the loop, depending on the value of a number you're incrementing
ive tried codingame but its more about concepts like how a for loop works rather than syntax
ive got quite a bit of experience with vba, I just struggle with different syntax
that works; then within the loop, instead of FILES[0] you'll have a variable that you're updating when a button is pressed, then doing something like FILENAME=FILES[VARIABLE_INCREMENTED_WHEN_BUTTON_PRESSED]
@rustic nymph the various CP code examples are actually pretty good examples of basic python syntax
@tulip sleet I built and loaded PR1177 to my Dongle -- anything special I should do to test it?
can't seem to get the array to advance
I tested the RGB LED with DriveMode.OPEN_DRAIN and also measured voltage on a regular DigitalInOut pin as 3.3v. This PR will reset the GPIO voltage setting if it is wrong. You could try bitbang SPI on a DotStar strip - that would be a stressy test I haven't done yet. Thanks.
FILES = FILES +=1
@velvet yarrow do you mind if we switch to private messages to keep the main channel clear?
Do feathers have a lot more memory than a trinket or itsy bitsy?
sure
OK -- That will have to be tomorrow - happy to try it then -- I'll need to add more header pins.
@rustic nymph it depends of the feather but probably not, uless you're talking about m0 vs m4
yeah m0 is what I have
BTW -- it took me a few tries to get the .uf2 loaded -- have you seen any odd behavior with NRFBOOT on linux?
to use OPEN_DRAIN -- just set led.drive_mode=digitalio.DriveMode.OPEN_DRAIN ?
Can you save code on the sd card here? https://www.adafruit.com/product/2796
you probably could, but I don't think the bootloader is set up to read it
maybe you could eval from file
idk
@rustic nymph you can save/run code from an SD Card -- looking for guide...
my bad
The bootlader does not access teh SDCard. You mount it after boot then set path and run code from it.
thank you
@solar whale @tulip sleet i can't seem to remember, and confidently answer my own question: did ustruct get renamed to struct on ESP8266? i've recommended try: import struct except: import ustruct on a library review. π
@raven canopy yes, it appears (from RTD) that it was renamed in 3.x; was ustruct in 2.x
but you need import ustruct as struct or vice versa to get consistent naming
in master it is struct https://github.com/adafruit/circuitpython/blob/master/ports/esp8266/mpconfigport.h#L199
This fixes a large number of crashes on malformed inputs. For more details, see pfalcon/uzlib#9 and pfalcon/uzlib#10
@tulip sleet @solar whale thanks. my reading of the makefile, and mpconfigport, were telling me that it has changed. but i just couldn't trust myself. π so, is there any reason a library would need ustruct anymore?
only if you were importing some third-party lib that used ustruct
then import struct as ustruct
or...to remain compatible with 2.x? yeah, i have it suggested like that. well, like so:
try:
import struct
except ImportError:
import ustruct as struct
Howdy folks: first THANK YOU! I have a fantastic solution for our user who wants to alert their professor (red/yellow/green/etc). I use PowerShell (yuk) and input() works (blocking, but it's good for now).
Second, is there a way in CircuitPython to show images to the HalloWing's TFT display?
@tough flax yay! kludgey still gets the job done! π
It would be a fantastic addition to this set of solutions
@tulip sleet sorry - just realized what you asked me to do - I don't have any dotstar LEDs to test.. I did try OPEN_DRAIN and it seems to work.
no problem - it will get a shakeout in the usual way. I did basic "unit testing" and I think it's ok. arturo182 will also take a look at the underlying code
sounds good.
$8 solution with a diffuser that clips on the laptop screen π
@tulip sleet can you confirm that this is the same build with pr 1177 ```Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 4.0.0-alpha-1070-ge335c74ac on 2018-09-09; PCA10059 nRF52840 Dongle with nRF52840
nevermind -- I found it in the PR
@tough flax I totally missed your HalloWing question. Thanks to Scott, the initial displayio module is in. Is still early days on it, and i can't explain how to use it..
@tough flax TFT + bitmap support for hallowing is coming very very soon, scott's hacking away at at, called displayio
woopz jinx
π
great minds
Thanks guys! π
yep. 2 days ago.
its there!
but i have no idea how to use it either
RTD is up as well, no real examples yet though. all in good time.. https://circuitpython.readthedocs.io/en/latest/shared-bindings/displayio/__init__.html#module-displayio
here's a hint code chunk
ok i got some zigbee radio action goin
im gonn zzz
i have been waiting to pounce on the PR. π good π€s @meager fog
iti has a long way to go
i just got a sniffer demo ported
which is a nice way to 'prove it works'
i dont have any way to send/receive packets yet
@slender iron DMA is going to be required. π¦ COUNT is not updated when using capture; it all goes to CC. at least on M4; haven't tried on M0 yet. Here are the registers during a couple captures.
1: without setting the TOP (COUNT16.COUNT.reg default):
2: with setting the TOP to full (COUNT16.COUNT.reg = 0xfff):
@raven canopy your code somewhere?
@slender iron not yet. going to bed, so late tomorrow most likely. have a thing tomorrow night...
kk, please post it so I can see what you are doing
will do!
thanks! goodnight! thanks for all of the reviews!
π
Really? The PTLAR only affects new pixels? I haven't tested it yet though.
@notro The different address could be due to the long-living of types. Maybe track that too?
Write speed is erase limited since we don't do any fancy block allocations. I would love to do balancing that erases after a write but that only helps for a single block.
We could also disable it by default once we have dynamic descriptors hooked up. Then it'd be clear when it happens.
@tulip sleet looking at the data sheet, I don't see nay restrictions on which GPIO Pins for the PCA10059, can be used for I2C or SPI. Is that the case, Any available pins can be used? It looks like the nrf52 is a bit for flexible than the SAMD51 in this regard, or am I missing something?
ah - I see in Table 7 of http://infocenter.nordicsemi.com/pdf/nRF52840_PS_v1.0.pdf that some GPIO are for Low freq (<10KHz) so should be avoided.
I'm trying to sample a 1kHz modulated light beam at 100Β΅s intervals. About every 1/32 sec I go into a coma for almost 1/32 sec while the system does its other things. More precise timing would not help unless we also had a "suspend the other system things for a mo while I do this time-critical thing" function...
On trinket m0, with CircuitPython 3.0.1, connecting through Mu (or any serial connection), on the REPL run command:
print("111111111122222222223333333333444444444455555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555")
After successful execution, press arrow up key.
Expected Result: view the previously executed command from ...
Hi,
any idea of when will the next CircuitPython release be?
@tulip sleet @indigo wedge I'm a bit confused about the pin assignments on the various nrf52840 boards - it may be that the pin packaging is different for the different boards so the restrictions for using some GPIO pins for low frequency (<10Khz) don't apply to all of the boards. On some of the boards - P1.10-15 are for Low frequency only, but are being assigned for use with SPI or I2C on different boards. For example on the feather_52480_express I2C is on P1.11/12 in pins.c -- I'm not sure which chip is on that board. But the table in that data sheet says they are for low freq on the part described there. http://infocenter.nordicsemi.com/pdf/nRF52840_PS_v1.0.pdf (Table 7) On the PCA10056, I have been using P1.10/11/12 for SPI and I note that the pins.c uses p1.13/14/15 but according to this document, those should all be low frequency. Am I looking at the wrong data sheet? Am I just confused....
@timber mango what for?
@slender iron no reason, I'm just curious
loading bunch of trinkets with software
we don't usually schedule it. we'll do a 3.0.2 soon to fix neopixels on the m4 but thats it
<@&356864093652516868> Meeting in just under an hour!
So we can show full color BMP images without loading them into RAM.
<@&356864093652516868> Meeting notes doc is here: https://docs.google.com/document/d/10bTW1mzjlweUv9BO9hk6YAw2jcfkTvnuMH_zlp2cC20/edit?usp=sharing
@slender iron fly-on-the-wall mode for me this week
kk
@slender iron I can take notes again
thanks @tulip sleet
I may be a little late. Had some colleagues pop in unannounced.. π
Lurking today
spamming the channel for two posts:
Newsletter
Adafruit Industries - Makers, hackers, artists, designers and engineers!
Catch the weekly news on Python for Microcontrollers withΒ adafruitdaily.com. ThisΒ ad-free, spam-freeΒ weekly e-mail is filled with all the Python news that you may have missed, all in one place! Comβ¦
i count 4 :)
(1) stats (2) hugs (3) progress (4) in the weeds
I'll delurk for :
Hug report:
Group hug
Status report:
I'm part of the micro:bit beta testing and I'm testing a new firmware and makecode & micropython editors that implement WebUSB to allow direct flashing to the micro:bit.
<lurk mode reactivated>
I have the fuzz too.
group hug
@"The nRF Crewe" (Dan, thach, Arturo, & Jerry) for continued work on that port. @tannewt for displayio foundation. Group hugus-maximus for any I'm missing!
just lurking today.
General hug report
@tannewt does the relocation code fixup the names that are bound to the object that's being relocated?
I guess it does, so it seems to be some function wrapping going on here:
=== f = None
===
=== class A:
=== def a(self):
=== pass
=== print(a, hash(a))
=== global f
=== f = a
=== print(f, hash(f))
===
<function a at 0x200029d0> 536881616
<function a at 0x200029d0> 536881616
>>> print(f, hash(f))
<function a at 0x2002d890> 537057424
>>> pr...
Busy at day job: no progress. Preparing for Maker Faire Zurich this week.
@tulip sleet I peeked the other day too at PWM. Def not obvious...
weeds topic -- nrf52 pin definitions
Congrats on the book, Mike!
FrequencyIn: OSCULP32K as DPLL source in work for crytaless boards. Have to establish a GCLK since it can't be sourced directly like XOSC32K. Then I should be able to assess jitter cause, as mentioned last week. Still discussing TC register usage/DMA with @tannewt.
Going to update VEML6070 library to match the new VEML6075 library in usage/structure.
Thanks @errant grail
O/
@slender iron I will figure out what happened
Thanks everyone! Keep up the amazing work! π 
thanks
π
So, we need to all buy the same cake for recording #52. π°
I used to live a few blocks from the Atlantic, but have never seen the Pacific.
Schwartzwalderkirchtorte
Black Forest peach? I've forgotten "kirch"...
Thereβs an Aberdeen in NJ, too.
And Maryland...
@raven canopy cherry
Doh! So "close"...
sorry, kirsch
Yes, in Dutch, Kirk is church.
sounds delicious!
Oh, never mind, I read it wrong
@slender iron I am back to having the same problem I had before with the mike. I am using the app and not the browset. D
Did you mute me?
OK, so. I completely missed the meeting... because I've got my mind in the guts of a CP project. A little ironic. Working on a Feather M0 Express, getting memory allocation failed when loading, but when I go into the REPL and use "Import main" (It's, so far, just a bunch of classes that I haven't put together into a functioning program yet), everything works fine.
This seems... odd
do you know at which moment you get the error?
I added another class, and it would do that. But if I go into the REPL, and import main, and use main.thatclass(), it works fine.
Right now I'm trying to tackle a different problem. I'm using the GPS library. Example works great. Writing my own code works... about 90% (So far)
That 10% is the GPS info won't update. Even using gps.update() until it returns "True". Even when doing that a few times, it still returns the same information.
@inland tusk I don't think I had you muted but I can check next week
<@&356864093652516868> The meeting recording is here: https://youtu.be/ee0Eaa60GOQ
Notes with time codes are available here: https://gist.github.com/tannewt/13bcfc94030a28b4a0ee471f84f4ad91 Thanks to @Dan Halbert for taking notes! Join here...
yup, it was 3 hours ago
I only planned for it to long live the reference accessible through the type. You've definitely hit a corner case where it doesn't work. https://github.com/adafruit/circuitpython/blob/master/py/objtype.c#L1056
I don't understand what you are trying to achieve enough to offer a fix.
Don't worry, @fluid helm, I was at my computer and I missed it.
unittest want to add properties to functions.
MicroPython doesn't support this: http://docs.micropython.org/en/latest/unix/genrst/core_language.html#user-defined-attributes-for-functions-are-not-supported
The workaround is to use a dictionary: FUNC_X[f] = 0
My problem is that the function object doesn't stay the same, so I can't use it as a key and look it up in the dict later.
I'm not sure if relocation is the first problem to attack here, because it looks like MP is wrapping...
worth reading
the largest Python project in the world
Circuit python hint of the day: If you are prototyping on a regular platform and deploying on a CP device, do NOT name your primary file code.py.
code is a built-in module and can confuse the debugger mightly
main.py gets along with other things much better.
Ugh, not that anyone cares (since it isn't even enabled in CP), but the prototype for
async def __aiter__(self):
is different in uPY/CP then in Python 3.7 (where it is
def __aiter__(self):
These little differences can drive you crazy
On the upside, you can defined a method in an if....
Brad Rodriguez' CamelForth for SAMD51
https://github.com/wa1tnr/CamelForth-SAMD51
this is an Atmel Start project and requires a CP2104 (PiUART) to talk to the USART of SAMD51
Hmm... Does the board auto-reload on ANY file change? Replacing the /lib directory contents seems to be taking forever
yeah ive found replacing /lib takes ages too
@slender iron here is code as it sits: https://github.com/sommersoft/circuitpython/blob/frequency_in_count/ports/atmel-samd/common-hal/pulseio/FrequencyIn.c
i only put up the .c; none of the other header/periphery. let me know if you want all that too...
@raven canopy I'm having trouble getting Mu to connect to the repl/USB IO... but I can connect with Putty... any ideas? This is after going to the latest build.
(Re-installing Mu now)
hmm. the only thing i could see interfering is if the serial connection was already claimed. which Mu version are you using? i vaguely remember an issue with beta-15...
which board? i'll see if i can replicate. i need to update Mu anyway. π
hallowing
at any rate, i couldn't replicate that. i've been on a purchasing drought. π
I'm so glad you were listening - that would have taken forever π I've been swapping between Trinket M0, CPX and the HalloWing and couldn't see the pattern π
Mu's still good as an editor, right? Just no IO
yeah
we're making it so going forward it wont be as picky
but right now each board must be programmed in
I was spoiled (I like mu! and I live/die w/Emacs!)