Giter Site home page Giter Site logo

Comments (10)

AlpesMachines avatar AlpesMachines commented on August 21, 2024

from opendeck.

paradajz avatar paradajz commented on August 21, 2024

Do you have some other board lying around? I've just tried the same procedure on my own Mega board and it works without issues.

from opendeck.

paradajz avatar paradajz commented on August 21, 2024

The firmware on main MCU will boot bootloader instead of firmware if any of the following is true:

  1. Hardware trigger is active. On Mega2560 board, this means that if MISO pin is tied to GND before power up, bootloader will be active (described here: https://github.com/paradajz/OpenDeck/wiki/Firmware-update#arduino-mega)
  2. Software trigger is active: This is true if in Web UI you've rebooted to bootloader mode. On AVR boards such as Mega2560, this will write special value to special EEPROM memory location. On reboot, if bootloader reads this value, bootloader will be enabled. Specifically, last EEPROM location is used (on Mega this is 4095). If this value is 0x47, bootloader will activate. Any other value and application is loaded.
  3. On startup, bootloader performs CRC check of firmware. If this validation fails, bootloader will be started instead of application. I suspect this is the part on your board that fails.
    https://github.com/paradajz/OpenDeck/blob/master/src/board/common/bootloader/Bootloader.cpp#L66

from opendeck.

orzel avatar orzel commented on August 21, 2024

As said, i had tried erasing the eeprom. The script was writing '00' everywhere. Following AlpesMahines message, I also tried using 0xff, but it doesn't help neither.
Unfortunately, i dont have another board to check. Though i've used this one for lot of (arduino) stuff, and never had any problem with it. I know about the hardware trigger, and even checked those pins to see if a short circuit was present. But nope.
Point 2 is probably not the reason, as i tried to zero the whole eeprom, and also to 0xff

I guess there's no way to know which reason triggered the DFU mode ?

I can't see why the CRC check would fail, i tried several times to flash everythingi (both MCU). I would like to try to disable the check, but i can't compiler here. Most scripts don't work here on linux. I already had to patch the 'flash.py' script to make it work here. Other scripts have lot of problem. It seems those scripts were mostly written for windows WSL, not actual linux.

from opendeck.

paradajz avatar paradajz commented on August 21, 2024

No, there isn't a way to tell which trigger activated bootloader.

Most scripts don't work here on linux.

Huh?

I already had to patch the 'flash.py' script to make it work here

Huh again? What did you change? It's also not a python script, it's a bash script, extension is .sh

Other scripts have lot of problem. It seems those scripts were mostly written for windows WSL, not actual linux.

Huh number 3. I have no idea what are you talking about here.

Which avrdude version are you using? What programmer are you using? What distro are you on?

from opendeck.

orzel avatar orzel commented on August 21, 2024

Yes, sorry, bash script.
No big deal for the change, it's because I use the usbasp programmer, not avrisp, so i had to remove the stuff about port (avrdude doesn't need a port for usbasp).

diff --git a/scripts/flash.sh b/scripts/flash.sh

index b2bda369..ae870acc 100755
--- a/scripts/flash.sh
+++ b/scripts/flash.sh
@@ -1,6 +1,7 @@
 #!/bin/bash
 
 run_dir="OpenDeck"
+find=find
 
 if [[ $(basename "$(pwd)") != "$run_dir"* ]]
 then
@@ -14,34 +15,6 @@ then
     exit 1
 fi
 
-if [ "$(uname)" == "Darwin" ]
-then
-    find="gfind"
-
-    if [[ "$(command -v gfind)" == "" ]]
-    then
-        echo "ERROR: GNU find not installed (gfind)"
-        exit 1
-    fi
-
-    port_list=$($find /dev -name "cu.*" -ls 2>/dev/null | sort | cut -d / -f3 | grep -v Bluetooth)
-elif [ "$(uname -s)" == "Linux" ]
-then
-    find="find"
-    port_list=$($find /dev/serial/by-id/ -type l -ls | grep -Eo '\btty\w+')
-fi
-
-if [[ "$port_list" == "" ]]
-then
-    echo "ERROR: No ports found. Please connect ArduinoISP before running the script."
-    exit 1
-fi
-
-echo "Please select serial port on which ArduinoISP is connected:"
-echo "$port_list" | cat -n
-read -r port
-port=$(echo "$port_list" | head -n "$port" | tail -n 1)
-
 echo "Please select board you want to flash and then press enter:"
 
 boards=$($find bin/compiled -type f -name "*.hex" -path "*merged/avr*" -printf '%f\n' | sort)
@@ -64,6 +37,6 @@ high_fuse=$(command < src/board/avr/variants/avr8/"$mcu"/fuses.txt grep ^high= |
 echo "Connect programmer to programming header on the board and then press enter."
 read -rn1
 
-avrdude -p "$mcu" -P /dev/"$port" -b 19200 -c avrisp -e -V -u -U lock:w:"$unlock_fuse":m -U efuse:w:"$ext_fuse":m -U hfuse:w:"$high_fuse":m -U lfuse:w:"$low_fuse":m
-avrdude -p "$mcu" -P /dev/"$port" -b 19200 -c avrisp -U flash:w:"$path"
-avrdude -p "$mcu" -P /dev/"$port" -b 19200 -c avrisp -V -u -U lock:w:"$lock_fuse":m
\ No newline at end of file
+avrdude -p "$mcu" -b 19200 -c usbasp -e -V -u -U lock:w:"$unlock_fuse":m -U efuse:w:"$ext_fuse":m -U hfuse:w:"$high_fuse":m -U lfuse:w:"$low_fuse":m
+avrdude -p "$mcu" -b 19200 -c usbasp -U flash:w:"$path"
+avrdude -p "$mcu" -b 19200 -c usbasp -V -u -U lock:w:"$lock_fuse":m

from opendeck.

orzel avatar orzel commented on August 21, 2024

The kind of error i have if trying to compile is:

orzel@berlioz tmp/OpenDeck/src% make target=mega2560
usage: yq [-h] [--yaml-output] [--yaml-roundtrip] [--width WIDTH]
[--indentless-lists] [--in-place] [--version]
[jq_filter] [files [files ...]]
yq: error: argument files: can't open 'bootloader.use': [Errno 2] No such file or directory: 'bootloader.use'
usage: yq [-h] [--yaml-output] [--yaml-roundtrip] [--width WIDTH]
[--indentless-lists] [--in-place] [--version]
[jq_filter] [files [files ...]]
yq: error: argument files: can't open 'arch': [Errno 2] No such file or directory: 'arch'
usage: yq [-h] [--yaml-output] [--yaml-roundtrip] [--width WIDTH]
[--indentless-lists] [--in-place] [--version]
[jq_filter] [files [files ...]]
yq: error: argument files: can't open 'mcu': [Errno 2] No such file or directory: 'mcu'
usage: yq [-h] [--yaml-output] [--yaml-roundtrip] [--width WIDTH]
[--indentless-lists] [--in-place] [--version]
[jq_filter] [files [files ...]]
yq: error: argument files: can't open 'mcuFamily': [Errno 2] No such file or directory: 'mcuFamily'
Defines.mk:85: *** MCU not supported. Arresto.

Or using the shell script:

orzel@berlioz clones/OpenDeck/src% ../scripts/build_targets.sh --type=fw_release
usage: yq [-h] [--yaml-output] [--yaml-roundtrip] [--width WIDTH]
[--indentless-lists] [--in-place] [--version]
[jq_filter] [files [files ...]]
yq: error: argument files: can't open 'release': [Errno 2] No such file or directory: 'release'
usage: yq [-h] [--yaml-output] [--yaml-roundtrip] [--width WIDTH]
[--indentless-lists] [--in-place] [--version]
[jq_filter] [files [files ...]]
yq: error: argument files: can't open 'test': [Errno 2] No such file or directory: 'test'

from opendeck.

orzel avatar orzel commented on August 21, 2024

Other scripts have lot of problem. It seems those scripts were mostly written for windows WSL, not actual linux.

Nope, sorry.
I had to change some bash code related to $($xxx), and I assumed it was because of a difference between bash in wsl and bash in linux. But actually it was my fault. Sorry again.

from opendeck.

paradajz avatar paradajz commented on August 21, 2024

I'm sorry but you're using USBasp here instead of supported programmer which is Arduino as ISP. I had some troubles with USBasp in the past which is why I'm not using it anymore, nor it is mentioned anywhere in the documentation or the code. Please don't open issues for stuff I don't support.

from opendeck.

orzel avatar orzel commented on August 21, 2024

Oh. You're rude.

from opendeck.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.