This repository contains firmware for main MCU STM32F103 of MTB-USB v4 module. MTB-USB module is a master module of MTBbus.
- Retransmit data between MTBbus and USB (PC).
- Do MTBbus (RS485) time-critical operations.
- Periodically poll MTBbus modules to let them report events.
- Maintain list of active & inactive modules. Poll active modules frequently, poll rest of the modules less frequently to allow to find new modules.
- Check if module responds to inquiry. When no response is get multiple times, report module as failed
- Behaves as CDC in PC.
- Red led: bad checksum of mtbbus received.
- Yellow led: USB send traffic.
- Permanently on: computer does not read from USB CDC.
- Permanently off: computer reads CDC, no data are sent.
- Flashing: computer reads CDC, data are sent to computer.
- Green led: MTBbus activity: polling MTBbus modules.
- Blue led left: no meaning yet.
- Blue led right: MTBbus powered.
-
Development:
arm-none-eabi-gcc
- bootloader:
build it and symlink
bootloader.bin
to built binary. make
$ make
-
Debugging:
openocd
arm-none-eabi-gdb
$ openocd $ arm-none-eabi-gdb build/mtb-usb-4.elf (gdb) target extended-remote :3333 (gdb) b main
-
Flashing: There are two independent options for firmware flashing to MTB-USB.
st-flash
(via STlink) MTB-USB module contains programming connector. Use STlink to program the MCU.$ make flash_with_bootloader
- Via DFU bootloader in MTB-USB (if bootloader already present in MTB-USB).
$ ./reboot_to_dfu.sh $ make flash_dfu
This application is released under the Apache License v2.0 .