-
Notifications
You must be signed in to change notification settings - Fork 3
Programming the C2C 64
The C2C-64 uses a MCU to setup the Video transcoding pipeline and to manage the UI through buttons, OLED screen and UART port. All this control code is part of the C2C firmware. This pages discusses the process to upload a new firmware to the C2C board.
Given the auxiliary nature of the MCU in this board, the project is not set on a specific MCU and will likely evolve in the future. So far, only two MCUs have been used, ATMega328P and ATMega328PB. Both are very similar and the main difference for the purpose of the C2C board is that the former greatly benefits from using an external crystal while the latter is in most circumstances ok running with the internal oscillator. In the future, it is likely that the C2C will start using the new generation of attiny MCUs, which feature similar capabilities but are considerably more affordable.
The ATMega family of MCUs can be easily programmed using the ICSP header. For space purposes, the C2C does NOT include the typical 2x3 header, but a 1x4 alternative that excludes Vcc and Gnd pins. It is important to note that the C2C works at 3.3V, so the ICSP programming device used needs to work at this voltage. I have found the Arduino DUE to be a fantastic way to program the C2C using the ICSP header using the ArduinoISP sketch included with the Arduino IDE. Remember to uncomment the #define USE_OLD_STYLE_WIRING
directive and follow the connection diagram shown in the figure below:
In a nutshell, pins 10 to 13 are connected to Rst, Mosi, Miso and Sck in that order. Gnd on the DUE should be connected to either the UART Gnd pin or the Oled Gnd pin. Vcc (3.3v) is not needed, the C2C can be directly powered from the Power jack. Alternatively, the 3.3v pin of the DUE can be connected to the Oled Vcc pin (in this case, do not power the C2C through the jack).
In general, ICSP programming is only needed to burn the fuses and the bootloader. There is a specific environment in the provided platformio configuration file to this end. Once fuses and bootloader are transferred to the MCU, the recommended procedure to upload a new firmware is through the use of the UART port.
The C2C project uses the MiniCore bootloader in combination with both ATMega328P/PB. The bootloader is executed when the MCU first resets, and given the right signals in the UART port is able to accept a bitstream and flash the MCU with new firmware.