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- 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.
 * 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
 * Improve arduino software to directly upload the binary file to the card

Week 7 (5,6/03/18)
Trying to :  Flash ESP-link on the ESP8266 Flash STM32F446 via serial converter to USB 

1. Version 3.0.14 successfully flashed. Access to [192.168.4.1] granted. Successfully added a web page to the ESP home.

2. Trying to use stm32flash to flash the Nucleo card. Hardwiring according to this.

BOOT0 pin set to HIGH (connected to 3v3 out). PB2 pin set to LOW (connected to GND). STM32F4 supports many UART combination. →TX: PA9; RX: PA10 (according to USART1 bootloader) TX: PB10; RX: PB11 (according to USART3 bootloader) TX: PC10; RX: PC11 (according to USART3 bootloader) Bootloader mode seems confirmed as application does not load.

Also, using the serial to USB converter : RX of the converter to TX of the microcontroller TX of the converter to RX of the microcontroller GND to GND of the microcontroller 3v3 out to 3v3 in of the microcontroller /!\ Error "Failed to init device." /!\ → changing the baud rate doesn't solve the problem ; removing ST-Link neither

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