• Playing with the I2C SAO Petal for Supercon 8

    11/07/2024 at 23:55 0 comments

    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

  • getting the pico usb host example compiled correctly

    12/01/2022 at 19:51 2 comments

    I couldn't find the picoprobe with openOCD until I flashed it with a pre compiled picoprobe.uf2 file instead of compiling it myself. If it works, it works - I guess.

    found the related issue where I got the working picoprobe.uf2 got from: https://github.com/raspberrypi/openocd/issues/71
    Basically pointing to this site where you can download the probe firmware:

    https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html#debugging-using-another-raspberry-pi-pico


    So apparently there's a tinyusb bug that will break the usb hid example and throw something like this at you:

    assertion "ep->active" failed: file "~/Projects/pico/pico-sdk/lib/tinyusb/src/portable/raspberrypi/rp2040/hcd_rp2040.c", line 164, function: hw_trans_complete

    This has something to do with the debug mode and you need a flag to run cmake first before compiling:

    PICO_SDK_PATH=~/Projects/pico/pico-sdk cmake .. -DCMAKE_BUILD_TYPE=Release
    make -j8

    I have yet to find out what the difference between -j8 and -j4 means but hey, that up their worked.

    link that helped: https://github.com/raspberrypi/pico-sdk/issues/649

    video that helped: 

  • Building openOCD for picoprobe on M1 mac

    12/01/2022 at 12:35 0 comments

    Had some trouble compiling the openOCD version for the picoprobe on the M1 macbook. This is based on a thread on github and the official guides, plus some blog posts that basically copied from each other.  

    https://github.com/raspberrypi/openocd/issues/7 

    #install additional brew libraries
    brew install libtool automake texinfo wget gcc pkg-config libusb
    
    # some path magic so compilers know where to look for stuff 
    export PATH="$(brew --prefix)/opt/texinfo/bin:$PATH"
    
    # download openocd files with picoprobe branch
    git clone https://github.com/raspberrypi/openocd.git \
      --branch picoprobe --depth=1
    
    cd openocd
    ./bootstrap
    
    # this enables the picoprobe and deactivates other modules that fail to compile otherwise
    CAPSTONE_CFLAGS="-I$(brew --prefix)/include" \                      
      ./configure --prefix="$(brew --prefix)"  \
      --enable-picoprobe --disable-presto --disable-werror --disable-openjtag
    
    make -j4
    
    # this will probably overwrite your current installation
    # and will break openjtag
    make install
    
    # optionally remove the installation folder
    cd ~/git
    rm -rf openocd