https://www.marcelpost.com/wiki/index.php?title=RS41-flashing&feed=atom&action=history
RS41-flashing - Revision history
2024-03-29T01:21:49Z
Revision history for this page on the wiki
MediaWiki 1.39.5
https://www.marcelpost.com/wiki/index.php?title=RS41-flashing&diff=3411&oldid=prev
Admin at 22:35, 15 September 2020
2020-09-15T22:35:09Z
<p></p>
<p><b>New page</b></p><div>If you've just retrieved an RS41 radiosonde and wonder how to get started with flashing it with your own code then this page is for you.<br />
<br />
===stopping the transmitter===<br />
<br />
When an RS41 is launched it holds 2x AA batteries that will keep the radiosonde transmitting for about 6 hours. The simplest way to stop the RS41 from transmitting is to press the on/off button briefly. The button is located under the sticker with the serial number, but just press it until the LED turns off.<br />
<br />
[[File:RS41-on-off-button.jpg]]<br />
<br />
===open the case===<br />
<br />
Pry open the two plastic tabs on the top and bottom to separate the two styrofoam halves that encapsulates the RS41 circuit board.<br />
<br />
<br />
===Connecting to the RS41 programming header===<br />
<br />
If you have a 2mm-pitch 2x5 IDC connector laying around you can use that, but most people will just have to solder four wires to the programming header.<br />
<br />
<pre><br />
____________________<br />
____________________| (circuit board)<br />
| 2 4 6 8 10 |<br />
| 1 3 5 7 9 | (programming connector)<br />
+------------+<br />
<br />
pin <br />
------------<br />
1 GND<br />
2<br />
3<br />
4 Vcc (3.3V !!)<br />
5<br />
6<br />
7<br />
8 SWCLK<br />
9 SWDIO<br />
10<br />
<br />
</pre><br />
<br />
Using a USB ST-Link programming dongle we connect the wires.<br />
<br />
<br />
<br />
===setting up the STM32 compiler environment===<br />
<br />
apt-get install <br />
<br />
<br />
<br />
===install the ST-Link software===<br />
<br />
Don't use the Debian apt version of stlink, but instead use the one on github or grab it with pip (python installer)<br />
<br />
git clone https://github.com/stlink-org/stlink.git<br />
<br />
pip<br />
<br />
===clear the write-protect flag of the flash memory===<br />
<br />
<pre><br />
start stlink debugger<br />
<br />
- batteries not required (power STM32 straight from STLink)<br />
- button press not required<br />
<br />
<br />
in one screen run:<br />
<br />
---[openocd debugger]---<br />
map@zhora:~/local/radiosonde-rs41$ openocd -f /usr/share/openocd/scripts/interface/stlink-v2.cfg -f /usr/share/openocd/scripts/target/stm32f1x.cfg <br />
Open On-Chip Debugger 0.10.0<br />
Licensed under GNU GPL v2<br />
For bug reports, read<br />
http://openocd.org/doc/doxygen/bugs.html<br />
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.<br />
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD<br />
adapter speed: 1000 kHz<br />
adapter_nsrst_delay: 100<br />
none separate<br />
Info : Unable to match requested speed 1000 kHz, using 950 kHz<br />
Info : Unable to match requested speed 1000 kHz, using 950 kHz<br />
Info : clock speed 950 kHz<br />
Info : STLINK v2 JTAG v29 API v2 SWIM v7 VID 0x0483 PID 0x3748<br />
Info : using stlink api v2<br />
Info : Target voltage: 3.306883<br />
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints<br />
---[]---<br />
<br />
<br />
<br />
<br />
<br />
then run telnet on another screen<br />
<br />
---[telnet localhost 4444]---<br />
map@zhora:~/local/radiosonde-rs41$ telnet localhost 4444<br />
Trying ::1...<br />
Trying 127.0.0.1...<br />
Connected to localhost.<br />
Escape character is '^]'.<br />
Open On-Chip Debugger<br />
> reset<br />
> halt<br />
target halted due to debug-request, current mode: Handler HardFault<br />
xPSR: 0x41000003 pc: 0x0800d5fc msp: 0x200015c0<br />
> flash info 0 <br />
device id = 0x10016420<br />
STM32 flash size failed, probe inaccurate - assuming 128k flash<br />
flash size = 128kbytes<br />
#0 : stm32f1x at 0x08000000, size 0x00020000, buswidth 0, chipwidth 0<br />
# 0: 0x00000000 (0x400 1kB) protected<br />
# 1: 0x00000400 (0x400 1kB) protected<br />
# 2: 0x00000800 (0x400 1kB) protected<br />
# 3: 0x00000c00 (0x400 1kB) protected<br />
# 4: 0x00001000 (0x400 1kB) protected<br />
# 5: 0x00001400 (0x400 1kB) protected<br />
# 6: 0x00001800 (0x400 1kB) protected<br />
# 7: 0x00001c00 (0x400 1kB) protected<br />
# 8: 0x00002000 (0x400 1kB) protected<br />
# 9: 0x00002400 (0x400 1kB) protected<br />
# 10: 0x00002800 (0x400 1kB) protected<br />
# 11: 0x00002c00 (0x400 1kB) protected<br />
# 12: 0x00003000 (0x400 1kB) protected<br />
# 13: 0x00003400 (0x400 1kB) protected<br />
# 14: 0x00003800 (0x400 1kB) protected<br />
# 15: 0x00003c00 (0x400 1kB) protected<br />
# 16: 0x00004000 (0x400 1kB) protected<br />
# 17: 0x00004400 (0x400 1kB) protected<br />
# 18: 0x00004800 (0x400 1kB) protected<br />
# 19: 0x00004c00 (0x400 1kB) protected<br />
# 20: 0x00005000 (0x400 1kB) protected<br />
# 21: 0x00005400 (0x400 1kB) protected<br />
# 22: 0x00005800 (0x400 1kB) protected<br />
# 23: 0x00005c00 (0x400 1kB) protected<br />
# 24: 0x00006000 (0x400 1kB) protected<br />
# 25: 0x00006400 (0x400 1kB) protected<br />
# 26: 0x00006800 (0x400 1kB) protected<br />
# 27: 0x00006c00 (0x400 1kB) protected<br />
# 28: 0x00007000 (0x400 1kB) protected<br />
# 29: 0x00007400 (0x400 1kB) protected<br />
# 30: 0x00007800 (0x400 1kB) protected<br />
# 31: 0x00007c00 (0x400 1kB) protected<br />
# 32: 0x00008000 (0x400 1kB) protected<br />
# 33: 0x00008400 (0x400 1kB) protected<br />
# 34: 0x00008800 (0x400 1kB) protected<br />
# 35: 0x00008c00 (0x400 1kB) protected<br />
# 36: 0x00009000 (0x400 1kB) protected<br />
# 37: 0x00009400 (0x400 1kB) protected<br />
# 38: 0x00009800 (0x400 1kB) protected<br />
# 39: 0x00009c00 (0x400 1kB) protected<br />
# 40: 0x0000a000 (0x400 1kB) protected<br />
# 41: 0x0000a400 (0x400 1kB) protected<br />
# 42: 0x0000a800 (0x400 1kB) protected<br />
# 43: 0x0000ac00 (0x400 1kB) protected<br />
# 44: 0x0000b000 (0x400 1kB) protected<br />
# 45: 0x0000b400 (0x400 1kB) protected<br />
# 46: 0x0000b800 (0x400 1kB) protected<br />
# 47: 0x0000bc00 (0x400 1kB) protected<br />
# 48: 0x0000c000 (0x400 1kB) protected<br />
# 49: 0x0000c400 (0x400 1kB) protected<br />
# 50: 0x0000c800 (0x400 1kB) protected<br />
# 51: 0x0000cc00 (0x400 1kB) protected<br />
# 52: 0x0000d000 (0x400 1kB) protected<br />
# 53: 0x0000d400 (0x400 1kB) protected<br />
# 54: 0x0000d800 (0x400 1kB) protected<br />
# 55: 0x0000dc00 (0x400 1kB) protected<br />
# 56: 0x0000e000 (0x400 1kB) protected<br />
# 57: 0x0000e400 (0x400 1kB) protected<br />
# 58: 0x0000e800 (0x400 1kB) protected<br />
# 59: 0x0000ec00 (0x400 1kB) protected<br />
# 60: 0x0000f000 (0x400 1kB) not protected<br />
# 61: 0x0000f400 (0x400 1kB) not protected<br />
# 62: 0x0000f800 (0x400 1kB) not protected<br />
# 63: 0x0000fc00 (0x400 1kB) not protected<br />
# 64: 0x00010000 (0x400 1kB) not protected<br />
# 65: 0x00010400 (0x400 1kB) not protected<br />
# 66: 0x00010800 (0x400 1kB) not protected<br />
# 67: 0x00010c00 (0x400 1kB) not protected<br />
# 68: 0x00011000 (0x400 1kB) not protected<br />
# 69: 0x00011400 (0x400 1kB) not protected<br />
# 70: 0x00011800 (0x400 1kB) not protected<br />
# 71: 0x00011c00 (0x400 1kB) not protected<br />
# 72: 0x00012000 (0x400 1kB) not protected<br />
# 73: 0x00012400 (0x400 1kB) not protected<br />
# 74: 0x00012800 (0x400 1kB) not protected<br />
# 75: 0x00012c00 (0x400 1kB) not protected<br />
# 76: 0x00013000 (0x400 1kB) not protected<br />
# 77: 0x00013400 (0x400 1kB) not protected<br />
# 78: 0x00013800 (0x400 1kB) not protected<br />
# 79: 0x00013c00 (0x400 1kB) not protected<br />
# 80: 0x00014000 (0x400 1kB) not protected<br />
# 81: 0x00014400 (0x400 1kB) not protected<br />
# 82: 0x00014800 (0x400 1kB) not protected<br />
# 83: 0x00014c00 (0x400 1kB) not protected<br />
# 84: 0x00015000 (0x400 1kB) not protected<br />
# 85: 0x00015400 (0x400 1kB) not protected<br />
# 86: 0x00015800 (0x400 1kB) not protected<br />
# 87: 0x00015c00 (0x400 1kB) not protected<br />
# 88: 0x00016000 (0x400 1kB) not protected<br />
# 89: 0x00016400 (0x400 1kB) not protected<br />
# 90: 0x00016800 (0x400 1kB) not protected<br />
# 91: 0x00016c00 (0x400 1kB) not protected<br />
# 92: 0x00017000 (0x400 1kB) not protected<br />
# 93: 0x00017400 (0x400 1kB) not protected<br />
# 94: 0x00017800 (0x400 1kB) not protected<br />
# 95: 0x00017c00 (0x400 1kB) not protected<br />
# 96: 0x00018000 (0x400 1kB) not protected<br />
# 97: 0x00018400 (0x400 1kB) not protected<br />
# 98: 0x00018800 (0x400 1kB) not protected<br />
# 99: 0x00018c00 (0x400 1kB) not protected<br />
#100: 0x00019000 (0x400 1kB) not protected<br />
#101: 0x00019400 (0x400 1kB) not protected<br />
#102: 0x00019800 (0x400 1kB) not protected<br />
#103: 0x00019c00 (0x400 1kB) not protected<br />
#104: 0x0001a000 (0x400 1kB) not protected<br />
#105: 0x0001a400 (0x400 1kB) not protected<br />
#106: 0x0001a800 (0x400 1kB) not protected<br />
#107: 0x0001ac00 (0x400 1kB) not protected<br />
#108: 0x0001b000 (0x400 1kB) not protected<br />
#109: 0x0001b400 (0x400 1kB) not protected<br />
#110: 0x0001b800 (0x400 1kB) not protected<br />
#111: 0x0001bc00 (0x400 1kB) not protected<br />
#112: 0x0001c000 (0x400 1kB) not protected<br />
#113: 0x0001c400 (0x400 1kB) not protected<br />
#114: 0x0001c800 (0x400 1kB) not protected<br />
#115: 0x0001cc00 (0x400 1kB) not protected<br />
#116: 0x0001d000 (0x400 1kB) not protected<br />
#117: 0x0001d400 (0x400 1kB) not protected<br />
#118: 0x0001d800 (0x400 1kB) not protected<br />
#119: 0x0001dc00 (0x400 1kB) not protected<br />
#120: 0x0001e000 (0x400 1kB) not protected<br />
#121: 0x0001e400 (0x400 1kB) not protected<br />
#122: 0x0001e800 (0x400 1kB) not protected<br />
#123: 0x0001ec00 (0x400 1kB) not protected<br />
#124: 0x0001f000 (0x400 1kB) not protected<br />
#125: 0x0001f400 (0x400 1kB) not protected<br />
#126: 0x0001f800 (0x400 1kB) not protected<br />
#127: 0x0001fc00 (0x400 1kB) not protected<br />
STM32F100 (Low/Medium Density) - Rev: Z<br />
> <br />
> reset<br />
> halt<br />
> flash protect 0 0 last off<br />
Device Security Bit Set<br />
target halted due to breakpoint, current mode: Handler HardFault<br />
xPSR: 0x61000003 pc: 0x2000003a msp: 0x200015c0<br />
cleared protection for sectors 0 through 127 on flash bank 0<br />
> flash info 0<br />
device id = 0x10016420<br />
flash size = 64kbytes<br />
#0 : stm32f1x at 0x08000000, size 0x00010000, buswidth 0, chipwidth 0<br />
# 0: 0x00000000 (0x400 1kB) not protected<br />
# 1: 0x00000400 (0x400 1kB) not protected<br />
# 2: 0x00000800 (0x400 1kB) not protected<br />
# 3: 0x00000c00 (0x400 1kB) not protected<br />
# 4: 0x00001000 (0x400 1kB) not protected<br />
# 5: 0x00001400 (0x400 1kB) not protected<br />
# 6: 0x00001800 (0x400 1kB) not protected<br />
# 7: 0x00001c00 (0x400 1kB) not protected<br />
# 8: 0x00002000 (0x400 1kB) not protected<br />
# 9: 0x00002400 (0x400 1kB) not protected<br />
# 10: 0x00002800 (0x400 1kB) not protected<br />
# 11: 0x00002c00 (0x400 1kB) not protected<br />
# 12: 0x00003000 (0x400 1kB) not protected<br />
# 13: 0x00003400 (0x400 1kB) not protected<br />
# 14: 0x00003800 (0x400 1kB) not protected<br />
# 15: 0x00003c00 (0x400 1kB) not protected<br />
# 16: 0x00004000 (0x400 1kB) not protected<br />
# 17: 0x00004400 (0x400 1kB) not protected<br />
# 18: 0x00004800 (0x400 1kB) not protected<br />
# 19: 0x00004c00 (0x400 1kB) not protected<br />
# 20: 0x00005000 (0x400 1kB) not protected<br />
# 21: 0x00005400 (0x400 1kB) not protected<br />
# 22: 0x00005800 (0x400 1kB) not protected<br />
# 23: 0x00005c00 (0x400 1kB) not protected<br />
# 24: 0x00006000 (0x400 1kB) not protected<br />
# 25: 0x00006400 (0x400 1kB) not protected<br />
# 26: 0x00006800 (0x400 1kB) not protected<br />
# 27: 0x00006c00 (0x400 1kB) not protected<br />
# 28: 0x00007000 (0x400 1kB) not protected<br />
# 29: 0x00007400 (0x400 1kB) not protected<br />
# 30: 0x00007800 (0x400 1kB) not protected<br />
# 31: 0x00007c00 (0x400 1kB) not protected<br />
# 32: 0x00008000 (0x400 1kB) not protected<br />
# 33: 0x00008400 (0x400 1kB) not protected<br />
# 34: 0x00008800 (0x400 1kB) not protected<br />
# 35: 0x00008c00 (0x400 1kB) not protected<br />
# 36: 0x00009000 (0x400 1kB) not protected<br />
# 37: 0x00009400 (0x400 1kB) not protected<br />
# 38: 0x00009800 (0x400 1kB) not protected<br />
# 39: 0x00009c00 (0x400 1kB) not protected<br />
# 40: 0x0000a000 (0x400 1kB) not protected<br />
# 41: 0x0000a400 (0x400 1kB) not protected<br />
# 42: 0x0000a800 (0x400 1kB) not protected<br />
# 43: 0x0000ac00 (0x400 1kB) not protected<br />
# 44: 0x0000b000 (0x400 1kB) not protected<br />
# 45: 0x0000b400 (0x400 1kB) not protected<br />
# 46: 0x0000b800 (0x400 1kB) not protected<br />
# 47: 0x0000bc00 (0x400 1kB) not protected<br />
# 48: 0x0000c000 (0x400 1kB) not protected<br />
# 49: 0x0000c400 (0x400 1kB) not protected<br />
# 50: 0x0000c800 (0x400 1kB) not protected<br />
# 51: 0x0000cc00 (0x400 1kB) not protected<br />
# 52: 0x0000d000 (0x400 1kB) not protected<br />
# 53: 0x0000d400 (0x400 1kB) not protected<br />
# 54: 0x0000d800 (0x400 1kB) not protected<br />
# 55: 0x0000dc00 (0x400 1kB) not protected<br />
# 56: 0x0000e000 (0x400 1kB) not protected<br />
# 57: 0x0000e400 (0x400 1kB) not protected<br />
# 58: 0x0000e800 (0x400 1kB) not protected<br />
# 59: 0x0000ec00 (0x400 1kB) not protected<br />
# 60: 0x0000f000 (0x400 1kB) not protected<br />
# 61: 0x0000f400 (0x400 1kB) not protected<br />
# 62: 0x0000f800 (0x400 1kB) not protected<br />
# 63: 0x0000fc00 (0x400 1kB) not protected<br />
STM32F100 (Low/Medium Density) - Rev: Z<br />
> <br />
---[]---<br />
</pre><br />
<br />
<br />
===flasing firmware===<br />
<br />
once the flash has been set to unprotected, it is now possible to write the .bin file in one simple way:<br />
<br />
st-flash --format binary write RS41HUP.bin 0x8000000<br />
<br />
<br />
btw, you may need to time it right to start this command as it may only accept incoming resets/writing data at the very beginning of powering up the device.<br />
<br />
===</div>
Admin