Black Lives Matter - Action and Equality. ... Adafruit is open and shipping.
0

Debug CircuitPython on PyPortal
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Debug CircuitPython on PyPortal

by crazycanuck on Tue Aug 20, 2019 8:04 am

Hi,

Am new to all things Python/CircuitPython, and I started playing around with the PyPortal. Specifically, I've tried out the ISS Tracker example. I've got a good general understanding of how it works, but where I am less certain is how/when the display gets refreshed. I was hoping that I could step through CircuitPython code executing like I can with Python code using PyDev in Eclipse, but that doesn't seem to be possible.

I've read the docs, but it's still not clear how screen refreshes are scheduled and what are the implications of calling refresh_soon() for example. The PyPortal example I am running displays a clock at bottom right and it jitters - that is, it is not consistent in how it increments the seconds. I know there are probably limitations with CircuitPython and the underlying hardware, but I would still like to better understand how it all works behind the scenes.

Note: I did notice a new release of CircuitPython 4.1.0, and that some changes that come with it may improve general performance. That said, I would still like advice on how best to learn the internals of the code and ideally be able to watch how and when the code is executed in real-time.

Thanks in advance for any help and advice.

crazycanuck
 
Posts: 19
Joined: Tue Nov 07, 2017 12:44 pm

Re: Debug CircuitPython on PyPortal

by danhalbert on Tue Aug 20, 2019 8:11 am

Have you seen this guide? https://learn.adafruit.com/circuitpytho ... -displayio.

We highly recommend updating to 4.1.0: display performance and general performance is much, much better.

The refresh logic and API is changing in 5.0 and will be easier to understand. Keep an eye on the 5.0.0-alpha releases.

danhalbert
 
Posts: 2055
Joined: Tue Aug 08, 2017 12:37 pm

Re: Debug CircuitPython on PyPortal

by crazycanuck on Tue Aug 20, 2019 9:28 am

Hi,

Thanks for the quick response. I will certainly give 4.1.0 a try and will keep an eye out for v5. Also, I did look at the guide, and it was helpful. However, it still didn't go down to the level of detail I was hoping for.

I'd be curious to know as a maintainer how you have setup your dev/debug environment.

Thanks again.

crazycanuck
 
Posts: 19
Joined: Tue Nov 07, 2017 12:44 pm

Re: Debug CircuitPython on PyPortal

by danhalbert on Tue Aug 20, 2019 9:36 am

Yuo're welcome. We develop on Linux or MacOS in general, and use J-Links and gdb to debug. We don't use an IDE.

danhalbert
 
Posts: 2055
Joined: Tue Aug 08, 2017 12:37 pm

Re: Debug CircuitPython on PyPortal

by crazycanuck on Tue Aug 20, 2019 11:26 am

Sorry, last question :-)

I'm assuming I would need to solder something like this https://www.adafruit.com/product/752 to the pads I see on the back of the PyPortal in order to connect J-Link?

Thanks again.

crazycanuck
 
Posts: 19
Joined: Tue Nov 07, 2017 12:44 pm

Re: Debug CircuitPython on PyPortal

by danhalbert on Tue Aug 20, 2019 12:54 pm

You can solder that, which is a bit tricky to solder. I've soldered a few, and my track record is not 100%: adding flux helps a lot. Alternatively you can solder jumpers or pins to the round SWD and SWC test points next to that, and use this breakout: https://www.adafruit.com/product/2743.

danhalbert
 
Posts: 2055
Joined: Tue Aug 08, 2017 12:37 pm

Re: Debug CircuitPython on PyPortal

by tannewt on Tue Aug 20, 2019 1:29 pm

The lowest level of API docs is available here: https://circuitpython.readthedocs.io/en ... nit__.html

That might provide you with the detail you are looking for.

tannewt
 
Posts: 1691
Joined: Thu Oct 06, 2016 8:48 pm

Re: Debug CircuitPython on PyPortal

by spersels on Tue May 26, 2020 1:25 am

danhalbert wrote:You can solder that, which is a bit tricky to solder. I've soldered a few, and my track record is not 100%: adding flux helps a lot. Alternatively you can solder jumpers or pins to the round SWD and SWC test points next to that, and use this breakout: https://www.adafruit.com/product/2743.


The pad frame on the board is clearly designed to accept some sort of detachable debug connector. Similar to the Segger needle adapter - but a different design. Yes, there are pads for a 10 pin header, but the other two (unplated) holes in the center of the pad frame are clearly designed to host some type of retention pins for a detachable debugging connector. Is Adafruit holding out on us??? Shame on you :)

IMG_20200526_010149 (003).jpg
debug port
IMG_20200526_010149 (003).jpg (197.17 KiB) Viewed 16 times


I've attached a picture of the debug pads and retention holes. Perhaps Adafruit is willing to bust loose with their secret debugging connector rather than making us try to solder stuff onto the their beautifully designed board. Can we get someone from Adafruit to comment on this please? This is clearly intentional :-(. Why would you put these pads here and not connect a header to them? Yes, it you are really using the test pins as test pins then the header would get in the way. But you have plenty of room on the board to put the test pins somewhere else. I see the retail price of the header is $1.50. Probably costs Adafruit less than half that. Adafruit seems to be intentionally trying to make it hard for us to use this debug port. Why? Are you trying to protect us from something?

spersels
 
Posts: 3
Joined: Tue May 26, 2020 12:56 am

Re: Debug CircuitPython on PyPortal

by danhalbert on Tue May 26, 2020 9:52 am

Our boards are tested using test jigs that clamp the board against pogo pins. See
https://learn.adafruit.com/how-to-make- ... n-test-jig
https://learn.adafruit.com/how-to-build ... ng-fixture

I don't know exactly why those extra holes are there, but they are not for a test fixture. They are under all our SWD box headers, even the tiny breakout: see the bottom-view picture here: https://www.adafruit.com/product/2743.

It appears that some brands of these connectors have alignment pins on some models. See the first page of (for instance).
http://suddendocs.samtec.com/catalog_english/tfm.pdf
The connectors we sell right now don't have these.

Adding an SWD connector to all PyPortals would drive up the cost. The increase would not be simply the incremental cost of the part: you could say the same thing about all the other parts on the board too. We tend to provide SWD connectors on boards that are used for development purposes, such as the Metro series.

It's your choice whether to solder an SWD header to the footprint or just solder wires to the the pads. We are not trying to protect you from anything.

As mentioned at the top, "Please be positive and constructive with your questions and comments." Thank you.

danhalbert
 
Posts: 2055
Joined: Tue Aug 08, 2017 12:37 pm

Re: Debug CircuitPython on PyPortal

by spersels on Tue May 26, 2020 8:25 pm

Thanks for your informative reply! Sorry if the tone of my note wasn't entirely "positive and constructive". It was actually intended as a little teasing. And perhaps just a little bit of venting of frustration after receiving my nice shiny new PyPortal and discovering that to really get into it I needed a) to buy another header - which I did finally find on Digikey ($1.5 for the part and $7 shipping) and b) solder it to the board myself - which I can do but I'll be doubly frustrating if I end up bricking the board and needing to start over (not that that's very likely)

Overall great product so far - looking forward to being able to get inside and explore the internals :)

Shawn

spersels
 
Posts: 3
Joined: Tue May 26, 2020 12:56 am

Please be positive and constructive with your questions and comments.