Skip to content

[NEW F18] Electrical Uploading Code

dtom2941 edited this page Aug 28, 2018 · 1 revision

One important task in preparing the buggy for rolls is making sure that the latest version of software is uploaded to the buggy's microcontroller(s). For Transistor, this means that the correct code must be uploaded to the Arduino Mega. For NAND, this means that the correct code must be uploaded to each of the several LPC11C24 microprocessors distributed across the system. These two upload processes are different. There is also a third (simpler) upload process for loading test code onto LPCXpresso Boards for NAND development purposes.

Loading Code onto the Arduino Mega (Transistor)

  1. Ensure that your git repository is up to date by pulling from GitHub.
  2. Connect your computer to the Arduino Mega using a USB cable.
  3. Open the command terminal (Linux/Mac) or open your linux VM and then open the command terminal (Windows)
  4. Navigate to /dev/ and ensure that a port of the form ttyACM0 or ttyACM1 shows up. This is the port you will use to program the Arduino.
  5. Navigate to Robobuggy/Electrical/Transistor/code/radio_mega_buggy
  6. Enter the command sudo make aprogram AVRDUDE_A_PORT=[Your port name from step 3]
  7. (Optional) Check to see if the program is running on the Arduino by navigating to RoboBuggy/Legacy/offline/debugging and running rbsm_console.py

Loading Code onto an LPCXpresso Board (NAND Development)

  1. Open your LPCXpresso development environment and make sure that you have the correct version of the code you wish to test.
  2. Connect your computer to the LPCXpresso board using a USB cable.
  3. In the lower-left panel, click "Build [Your Project Name] [Debug]"

Loading Code onto an LPC11C24 Board In-System (NAND Production)

  1. Go to <Project_Name> -> Properties -> C/C++ Build -> Settings ->Build steps-> Post-build steps, and click "Edit" under "Command". Add the following line BEFORE the "#" character: arm-none-eabi-objcopy -O ihex "${BuildArtifactFileName}" " ${BuildArtifactFileBaseName}.hex" After this is done, the Post-build steps command should look like the following: arm-none-eabi-size "${BuildArtifactFileName}" arm-none-eabi-objcopy -O ihex "${BuildArtifactFileName}" " ${BuildArtifactFileBaseName}.hex" # arm-none-eabi-objcopy -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin" This outputs a hex file, which we need to feed into flashmagic tool.

  2. Follow the Adafruit flash magic tutorial (related but not the same exact setup) https://learn.adafruit.com/getting-started-with-the-lpc810/programming-the-lpc810-with-flash-magic

  3. When you are ready to program the device: a) Hold the RESET button. Do not let go of it. b) Hold the ISP button. Do not let go of it. c) Release the RESET button. d) Start the Flash Magic flash operation. e) Once Flash Magic says that the operation is completed, release the ISP button.