Close

Playing with the I2C SAO Petal for Supercon 8

davedarkodavedarko wrote 11/07/2024 at 23:55 • 2 min read • Like

My first tripup was that GPIO1 was not soldered on the badge, glad I caught it!

I also soldered an LED leg as a jumper for the programming pin on the SAO to be always connected to GPIO1.

 It seems like there's a little issue with the Supercon image and getting the programmer to run, but the programmer works with the vanilla RP2040 PICOW image. These are the files that are on the image to start with.

Followed by this file tree, when I upload the programmer onto the badge as well.

I create another file and copy in the example that is written in flash_ch32v003.py - note here that I have to comment out the "or" in between the example.

>>> %Run -c $EDITOR_CONTENT
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
  File "flash_ch32v003.py", line 35, in __init__
ValueError: StateMachine claimed by external resource
>>> 

This is something that others have noticed before - by changing the used statemachine from 4 to 3, this error went away. When I run the program now, I get this output, but it is still blinking, instead of putting out touch values. 

>>> %Run -c $EDITOR_CONTENT
Time spent: 545482
0x0 0x0
0x1 0x0
0x2 0x0
0x3 0x0
>>> 

With the vanilla Micropython from https://micropython.org/download/RPI_PICO/ I also just copy the files onto the badge and run the code from REPL and it works. Therefore I doubt that it is a hardware issue and must have something to do with the supercon image. 


It seems like just changing the state machine number in the "StateMachine" function is not enough, you also have to change the "unavoidable bit-twiddling" bit, If you want to use a statemachine smaller than zero, then you have to change the PI1_BASE value to PI0_BASE and add the correct state machine SM1_EXECCTRL. It seems like I2C on the PICO W leads to a different state machine being used, which then breaks the flasher.

Here's my pull request on github with the changes:

https://github.com/hexagon5un/pico_ch32v003_prog/pull/3/commits/2969a4c86f1d7a7f7e61d8a69b40ba99e09288a0

Like

Discussions