SWD programming using a RaspberryPi

I previously write this post on how to use a BeagleBoneBlack as a JTAG (SWD) programmer. It was fun but really slow. I port my code on RaspberryPI and now what was taken 5-8 hours is a couple of minutes.

To connect the SWD connector to the PI use the following schema

Connect SWD to RaspberryPi

Connect SWD to RaspberryPi

I use this peace of code to reflash my TD1204 and TD1208 based both on EFM32 when bricked after unsuccessful update…

Here is the python file to interact with SWD : https://github.com/disk91/PySWD/blob/master/RpiGPIO.py

I hop it will be soon integrated in the main PySWD project as the previous one.

You should check or modify flashEFM32.py file

import array

from PirateSWD import *
from RpiGPIO import *
from SWDCommon import *


def main():
    busPirate = RpiSWD("", vreg = True)
    debugPort = DebugPort(busPirate)
    efm32     = EFM32(debugPort)

To run the Flash program, just launch

# ./flashEFM32.py ../myProgram.bin


5 thoughts on “SWD programming using a RaspberryPi

  1. Hi,

    It worked for me! It took about 20min to flash my .bin.
    However I don’t receive messages on Sigfox portal anymore: I’ve tested it with the basic sigfox.c (RF_Examples). The LED does turn on and then off after a moment (after Sigfox message should be sent) but I get nothing on the portal. Is it possible that the ID while flashing with RaspberryPI? Do you have any idea for the reasons I don’t get my messages anymore?

    Thank you,

    PS: I tried to check the ID using Putty and the command ATI7 but I can’t establish a serial connexion.

    • No the ID does not changed when falshing (I never had a such problem) Are you sure your antenna is correctly connected (I had some trouble when soldered the antenna pins and get a shortcup between these pins)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.