OpenMote-CC2538 bootloading fails on the OpenUSB board

Description

The new OpenUSB board uses the CP2104 instead of the FT232 for the USB to UART converter.
Currently the cc2538-bsl.py script uses a datarate of 400000 baud that was supported by the FT232 but (for some strange reason) is not supported by the CP2104. This makes the bootloading mechanism fail stating an ioctl error as summarized next.

pere@osiris:~/Desktop/GitHub/openwsn-fw$ sudo scons board=OpenMote-CC2538 toolchain=armgcc bootload=/dev/ttyUSB0 oos_openwsn
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
Dynifying build/OpenMote-CC2538_armgcc/openapps/openapps_dyn.c
arm-none-eabi-size --format=berkeley -x --totals build/OpenMote-CC2538_armgcc/projects/common/03oos_openwsn_prog
text data bss dec hex filename
0x19a2c 0x400 0x1cb0 113372 1badc build/OpenMote-CC2538_armgcc/projects/common/03oos_openwsn_prog
0x19a2c 0x400 0x1cb0 113372 1badc (TOTALS)
OpenMoteCC2538_bootload(["build/OpenMote-CC2538_armgcc/projects/common/03oos_openwsn_prog.phonyupload"], ["build/OpenMote-CC2538_armgcc/projects/common/03oos_openwsn_prog.ihex"])
starting bootloading on /dev/ttyUSB0
ERROR: [Errno 25] Inappropriate ioctl for device
done bootloading on /dev/ttyUSB0
scons: done building targets.

Since the released OpenUSB board will be based on the CP2104 and the both chips support 500000 baud as the datarate for bootloading, it is suggested to update the Sconscript to call the cc2538-bsl.py with the appropriate parameters.

As it can be seen below, it works just fine with a datarate of 500000 bauds.

pere@osiris:~/Desktop/GitHub/openwsn-fw$ sudo scons board=OpenMote-CC2538 toolchain=armgcc bootload=/dev/ttyUSB0 oos_openwsn
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
Dynifying build/OpenMote-CC2538_armgcc/openapps/openapps_dyn.c
arm-none-eabi-size --format=berkeley -x --totals build/OpenMote-CC2538_armgcc/projects/common/03oos_openwsn_prog
text data bss dec hex filename
0x19a2c 0x400 0x1cb0 113372 1badc build/OpenMote-CC2538_armgcc/projects/common/03oos_openwsn_prog
0x19a2c 0x400 0x1cb0 113372 1badc (TOTALS)
OpenMoteCC2538_bootload(["build/OpenMote-CC2538_armgcc/projects/common/03oos_openwsn_prog.phonyupload"], ["build/OpenMote-CC2538_armgcc/projects/common/03oos_openwsn_prog.ihex"])
starting bootloading on /dev/ttyUSB0
Opening port /dev/ttyUSB0, baud 500000
Reading data from build/OpenMote-CC2538_armgcc/projects/common/03oos_openwsn_prog.ihex
Firmware file: Intel Hex
Connecting to target...
CC2538 PG2.0: 512KB Flash, 32KB SRAM, CCFG at 0x0027FFD4
Primary IEEE Address: 06:15:A4:89:00:12:4B:00
Erasing 524288 bytes starting at address 0x00200000
Erase done
Writing 524256 bytes starting at address 0x00200000
Write 232 bytes at 0x0027FEF88
Write done
done bootloading on /dev/ttyUSB0
scons: done building targets.

Environment

None

Assignee

Tengfei Chang

Reporter

Pere Tuset

Labels

None

Story Points

None

Due date

2016/09/08

Priority

Critical
Configure