documentation | ||
schematic | ||
.gitignore | ||
LICENSE.md | ||
README.md |
TOSR-04
The board :
The purpose of this project is to write and flash a custom firmware in the MCU powering this board. Indeed, this relay board was meant to be controled by sending very poorly designed serial commands which I want to get rid of !
The manual :
The user guide is available here if you want to learn more about this module's capabilities
The schematic :
The schematic is available here.
Project folder architecture :
/
|_src This folder contains all the C/C++ file sources.
| \_app This folder contains the main app and it's dependencies.
| |_libs This folder contains all the required 3rd party libraries that should be put in "Arduino\libraries" folder in order for the app to compile.
| |_test This folder contains a test program which was used to test the dependencies.
|
|_schematic This folder contains all the files associated with the schematic
| \_KiCad This folder contains the KiCad files associated with the project.
| |_TOSR-04.pdf Which is the most recent schematic exported as a pdf for quick viewing.
|
|_documentation This folder contains all documentation and resources to work on the project.
|
|_.gitignore
|_LICENSE.md
|_README.md The content of this page
What I am planning to do :
- Reverse engineer the schematic of this board (because it is not available) (DONE !)
- The schematic is now available as a pdf file in the schematic folder
- Find the best way to flash a custom firmware on the ATMEGA328PU (DONE !)
- Check the section : The best way to flash a firmware section hereunder
- Write a custom firmware for it (TO DO)
The best way to flash a firmware
To be honest, the best way to flash our own firmware on this board is to replace the ATMEGA328PU with one which has the Arduino bootloader burnt on it :-(.
Indeed after looking at the reverse engineered schematic, the SPI pins needed for an ISP are not exposed (they are not even used...).
Fortunately enough, the onboard FTDI seems to be connected with the DTR line which is connected through a capacitor to the ATMEGA's reset pin that is required by the Arduino bootloader.
I will test it this weekend and keep you informed.
The test is done and IT WORKS !!!.
- I took an Arduino pro mini 3.3V 8MHz. I desoldered the ATMEGA328PU that was on it and soldered it on the relay board.
- I then connected the relay board to the PC with an USB cable and started the Arduino IDE.
- In the tools menu of the IDE I chose the Arduino UNO board and I flashed the blink sketch.
- The download process worked and the led L (which is pin 13 luckily) started blinking as expected.
- We can now write our own firmware.
Could the onboard ATMEGA be saved ?
I will try to restore the chip to it's factory state by programming it with a HVPP (High Voltage Parallel Programmer) in order to reset the fuse bytes as well if they are set of course ...
If I succeed, I'll explain how I did it here.
FAQ
- Why is it not possible to reprogram the chip or to burn a bootloader on the relay board ?
- The first issue is that the pins required for an ISP are not exposed :(. The way around it would be to parallel program it, but for that you need to desolder the chip anyway.
- The second issue is that the fuse bytes are probably set (I dont actually know for sure) in a way to prevent easy access to the chip. Only a High Voltage Reprogramming of the chip could "unlock it".
If you have any questions, do not hesitate to contact me at : bugreport[at]laposte[dot]net