RICM4 2017 2018 - Nucleo

= Project presentation = The goal of this project is to be able to re-program the NUCLEO STM32F446RE from a remote place, using wifi.

An user must be able to send a binary program to the Wifi Chipset ESP8266EX plugged on the NUCLEO STM32F446RE. That last one receives the binary, flashes it, and execute its new program.

Then and if we have time, we can look forward on the security issues of this system and try to fix them. = Equipment = = Team = Members :
 * OLIMEXINO-328
 * NUCLEO STM32F446RE
 * Wifi Chipset ESP8266EX
 * Two computers with the sofware Arduino and Mbed.
 * CHANET Zoran
 * CHARLOT Servan

Supervisor :
 * Olivier RICHARD

= Progress =

Week 1 (15/01/18)
This subject was assigned to us.

Received the cards. (But one of them was broken)

Discovering the cards and the documentation.

Week 2 (22/01/18)
Testing codes samples on the cards to get familiar with the language.

Week 3 (29/01/18)
Experimenting the input/outputs capacities of the cards, by redirecting power on some chosen pin to trigger a LED, or sending data on the serial port.

Week 4 (05/02/18)
Linking the two cards together to simulate a serial connection between them.

Then, sending data to one card (via the serial port of a computer) and see if we are able to receive it on the other one (by printing it on the serial port, connected to another computer).

Week 5 (12/02/18)
Creating UML diagrams and this page.

Studying the ESP8266EX documentation and finding a way to to connect it to the Nucleo.

Week 6 (26,27/02/18)
Configuration of the ESP8266.

Hardwiring : (according to jeelabs ESP-link documentation, esp-01 device) Trying to flash esp-link-v3.0.14 onto the esp8266ex (512KB flash size, 40m frequency), using esptool.py (if strangely installed, esptool.py is to be found in ~/.local/lib/python2.7/site-packages), following those steps : esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash -fs 512KB -ff 40m \ 0x00000 boot_v1.6.bin 0x1000 user1.bin \ 0x7C000 esp_init_data_default.bin 0x7E000 blank.bin
 * URXD: connect to TX of microcontroller
 * UTXD: connect to RX of microcontroller
 * GPIO0: connect to RESET of microcontroller
 * GPIO2: optionally connect green LED to 3.3V (indicates wifi status)
 * GND: connect to GND of microcontroller
 * VCC+CH-PD: connect to 3v3 output of microcontroller
 * flash boot_v1.X.bin from the official SDK or from the release tgz to 0x00000
 * flash blank.bin from the official SDK or from the tgz to 0x3FE000
 * flash esp_init_data_default.bin from the official SDK or from the tgz to 0x3FC000
 * flash user1.bin to 0x01000

/!\ Error : A fatal error occurred: Failed to connect to Espressif device: Timed out waiting for packet header /!\ → changing the baud rate doesn't seem to solve the issue

New attempt based on these connections : Exact same error.
 * URXD: connect to TX of microcontroller
 * UTXD: connect to RX of microcontroller
 * GPIO0: connect to GND of microcontroller
 * GND: connect to GND of microcontroller
 * VCC+CH-PD: connect to 3v3 output of microcontroller

According to jeelabs ESP-link documentation again, on both hardwiring models an attempt of putting GPIO2 to high in order to flash the ESP8266 was unsuccessfully made.

-Ideas for next weeks-
 * Adapt the avrflash to flash the stm32 card
 * Ask the issue 205 man if he did it already
 * Stm32 bootloader serial port forwarding ?
 * See this from issue 250
 * Hello :)
 * I wrote a patch for stm32flash that allow use it with esp-link.
 * Currently its in dirty stage so no automatic baudrate/mode setting, but will try to add it in few days.
 * So here are my steps to flash stm32f030:
 * Clone and build my version of stm32flash from: https://bitbucket.org/hetii/stm32flash
 * Pull boot0 high.
 * Reset stm32 by low pulse on NRST.
 * Run stm32 to flash your software.
 * Change back boot0 to low and reset uC.
 * Improve arduino software to directly upload the binary file to the card

= Links =
 * Projects list
 * SRS
 * UML
 * Documentation