Skip to content

mppmu/mdttp-cm-demo-mcu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

97 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ATLAS MDT Trigger Processor (TP) Command Module (CM) Demonstrator Microcontroller (MCU)

Auth: M. Fras, Electronics Division, MPI for Physics, Munich
Mod.: M. Fras, Electronics Division, MPI for Physics, Munich
Date: 09 Apr 2020
Rev.: 22 Mar 2022

Prerequisites

Software

  • ARM GCC.
  • GNU make.
  • Firmware flashing tool lm4flash.
  • Minicom terminal program.
  • ARM GDB and nemiver graphical debugger.
  • Python 3 and required modules.

Hardware

  • ATLAS MDT Trigger Processor (TP) Command Module (CM).
  • TI Tiva TM4C1294 Connected LaunchPad Evaluation Kit board (for programming and debugging).

Getting Started

  1. Install required packages. Example for Ubuntu 18.04.
    ARM cross compiler toolchain.

    sudo apt-get install build-essential gcc-arm-none-eabi binutils-arm-none-eabi openocd

    Firmware flashing tool.

    sudo apt-get install lm4flash

    Minicom terminal program.

    sudo apt-get install minicom

    ARM GDB and nemiver graphical debugger.

    sudo apt-get install gdb-multiarch nemiver

    Python 3 and required modules.

    sudo apt-get install python3 python3-serial python3-tk
  2. Preparations for firmware download.
    Before installing the serial boot loader or downloading firmware, make sure that these conditions are met:

    • The TM4C1294 Connected LaunchPad™ Evaluation Kit is connected to an USB port of the PC.
    • Its resistors R8, R10, R11, R15 and R16 are removed.
    • Its header U6 is connected with a 10-pin 50 mil pitch flat cable to X113 of the CM.
    • The jumpers X122, X123, X125 and X126 on the CM are in the correct position to connect the MCU SWD pins to the header X113.
    • By default, always download the MCU firmware with no other power source provided to the CM. Alternatively, if the CM is powered with +12 V, cut the pin 1 of the flat cable to avoid connecting to power supplies.
  3. Install the serial boot loader.
    The serial boot loader provides firmware updates over the UART 5, which is connected to the SM SoC and is normally used for the user interface. In order to build and install the boot loader, change to the Firmware/Projects/boot_loader directory and run this command:

    make install
    

    The boot loader sits at address 0x0000 of the flash, the main firmware image starts at address 0x4000.

    The 8 MCU user LEDs indicate activity of the boot loader:

    • The LED red 2 blinks during the countdown of the boot loader.
    • The LED red 2 is on when the boot loader is active.
    • During firmware download via the boot loader, the LEDs red 1 and red 2 are on and the remaining LEDs (blue 1/2, orange 1/2, green 1/2) count up.
    • When the firmware download via the boot loader is finished, all 8 MCU user LEDs blink 3 times indicating the end of the firmware download.

    Note that the UART for the boot loader can be changed to UART 3, which is the front panel UART of the CM. Define MDTTP_CM_MCU_BL_UART_FRONTPANEL in the file bl_config.h to use UART 3 instead of UART 5 for the boot loader.

    Example minicom session for the serial boot loader:

    ***** MDT-TP CM MCU boot loader version 0.0.3, release date: 28 Aug 2020 *****
    
    Press any key to enter the boot loader menu.
    5 4 3 2 1
    
    Boot Loader Menu
    ================
    
    Available commands:
    h   Show this help text.
    b   Start normal boot process.
    f   Force MCU firmware download via the serial boot loader.
    r   Reboot the MCU.
    > f
    
    
    
    ***** MDT-TP CM MCU boot loader version 0.0.3, release date: 28 Aug 2020 *****
    
    Waiting for firmware data...
    
  4. Compile and download the firmware project for hardware testing.
    Change to the Firmware/Projects/cm_mcu_hwtest directory. Then clean the firmware project directory.

    make clean

    This will wipe all compiled files and backups of source files from the project.

    make mrproper

    Build the firmware project.

    make

    Download the firmware.

    make install

    Compile and download a debug version of the firmware, then start the nemiver graphical debugger. Please note that there is a breakpoint set at the start of the program! This prevents it from running until the program is continued from the debugger.

    make debug

    After you have finished debugging, build and download the normal firmware version again.

    make clean install
  5. Firmware download via the serial boot loader.
    Once the serial boot loader is installed, you can use it to download the main firmware. To do so, hit any key during the countdown after power-up to enter the boot loader menu. Then press the key f to force a firmware update. Now quit the terminal program, change to the Firmware/Projects/cm_mcu_hwtest directory and download the main firmware via the serial boot loader.

    make sflash

    If not yet done, this will automatically build the sflash tool that comes with the TivaWare. After the firmware download, the MCU reboots automatically.

    Note that you may need to change the serial device in the Makefile from /dev/ttyUL1 to the one your computer uses to communicate with the UART of the MCU.

    Optionally, you can also run the sflash tool from the command line:

    sflash -c /dev/ttyUL1 -p 0x4000 -b 115200 -d -s 252 gcc/cm_mcu_hwtest.bin
  6. Communicate with the MCU using the minicom terminal program.
    Create a file .minirc.cm_mcu in your home directory with this content:

    pu port             /dev/ttyUL1
    pu rtscts           No
    

    Adapt the pu port to the serial input to which the MCU UART user interface is connected. This is usually /dev/ttyUL1 when using the SM SoC UART and /dev/ttyUSB0 when using the CM front panel mini USB UART.

    Launch minicom either by calling make minicom inside the firmware directory or by starting minicom from the shell minicom -c on hw_demo. To quit minicom, press Ctrl-A, then Q. To edit the minicom settings, press Ctrl-A, then Z.

    Example minicom session:

    *******************************************************************************
    MDT-TP CM MCU `cm_mcu_hwtest' firmware version 0.2.0, release date: 27 Aug 2020
    *******************************************************************************
    
    Type `help' to get an overview of available commands.
    > help
    Available commands:
      help                                Show this help text.
      bootldr                             Enter the boot loader for firmware update.
      delay   MICROSECONDS                Delay execution.
      gpio    TYPE [VALUE]                Get/Set the value of a GPIO type.
      i2c     PORT SLV-ADR ACC NUM|DATA   I2C access (ACC bits: R/W, Sr, nP, Q).
      i2c-det PORT [MODE]                 I2C detect devices (MODE: 0 = auto,
                                              1 = quick command, 2 = read).
      info                                Show information about this firmware.
      reset                               Reset the MCU.
      temp-a  [COUNT]                     Read analog temperatures.
      uart    PORT R/W NUM|DATA           UART access (R/W: 0 = write, 1 = read).
      uart-s  PORT BAUD [PARITY] [LOOP]   Set up the UART port.
      power   DOMAIN [MODE]               Power domain control (0 = down, 1 = up).
    >
    

Literature

TM4C1290NCPDT High performance 32-bit ARM® Cortex®-M4F based MCU

TM4C1290NCPDT High performance 32-bit ARM® Cortex®-M4F based MCU

Getting Started, HOWTOs, Tutorials

Tiva C Series Connected Launchpad Getting Started EK-TM4C1294XL

About

ATLAS MDT Trigger Processor (TP) Command Module (CM) Demonstartor MCU

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published