Firmware upgrade STM32Wifi
This upgrade procedure currently requires Linux. I'm sure ST has a tool for windows, but I haven't come across it. If you know the procedure under windows, let me know, or expand this page.
tools required
- A Linux PC.
- dfu-util installed.
- Optionally: A config file.
Installing dfu-util
dfu-util is part of the Ubuntu distribution:
apt-get install dfu-util
should do the job for users of recent ubuntu distributions.
Otherwise, cloning the git repository and compiling that should work:
git clone https://gitorious.org/dfu-util/dfu-util.git cd dfu-util ./autogen.sh ./configure make make install
(I did this a while ago, this was typed from memory. If you do it, let me know if it works).
performing the upgrade
You need a binary. It's currently called chwifi.bin.
Put the device in DFU firmware upgrade mode: Move the jumper to the position towards the crystal. Then insert the USB cable. The device should enumerate as an STM-DFU device: "Product: STM32 BOOTLOADER".
Then issue:
dfu-util -a 0 -d 0483:df11 -s 0x8000000 -D chwifi.bin
If you want to configure your stm32wifi over a ttl-level serial port, then you're done: move the jumper back and reboot the device (powercycle or hit the reset button).
Otherwise you need to generate a config file:
create the script makeconfigbin:
#!/bin/sh if [ $# -ne 4 ] ; then echo usage $0 ssid password host url exit 1 fi #makechar 255 255 255 255 makeconfigstring 32 "$1" makeconfigstring 32 "$2" makeconfigstring 64 "$3" makeconfigstring 64 "$4"
and makeconfigstring:
#!/bin/sh len=$1 str=$2 tmp=`tempfile` #for i in `seq $len` ; do # makechar 255 >> $tmp #done dd if=/dev/zero bs=$len count=1 | tr '\0' '\377' > $tmp (echo -n $str ; dd if=/dev/zero bs=1 count=1 ) | dd of=$tmp conv=notrunc cat $tmp rm $tmp
Now you can run the makeconfigbin script and provide it with your wifi credentials and the server host and URL:
./makeconfigbin <wifissid> <wifipassword> www.bitwizard.nl /esp/logit.php\? > config.bin
Put in your own wifi ssid and password. Then:
dfu-util -a 0 -d 0483:df11 -s 0x801fc00 -D config.bin
will flash it into permanent storage of the stm32wifi.
Note that if you change the wifi credentials, the device will continue to attempt to use the old wifi. Only when that fails will it switch to the new credentials.