Git Product home page Git Product logo

mcp-can-boot's Introduction

mcp-can-boot's People

Contributors

crycode-de avatar de-backer avatar hankedan000 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

mcp-can-boot's Issues

Entering flashing mode

From what what i can see, i have to reset the mcu manually in order to enter flashing mode, is there any option to do this from the app ?

ESP32

Hi Peter,

Is it possible to use this bootloader for ESP32 chips?

Thanks
Hugh

Question about MCUID parameter

Hi, I'm trying to run can bootloader on arduino pro mini (with 328p mcu). Fuse bits are set and bootloader flashed without errors. Now I try to upload sample .hex file npx mcp-can-boot-flash-app -f firmware.hex -p ATmega328P -m 0x0042, after receiving message Waiting for bootloader start message for MCU ID 0x0042 ... I'm pressing reset button on arduino pro mini board, but nothing happend after it. I also have candump opened, and no message are coming on can0 interface. I assume that I have to change MCUID, but I'm not sure, where to get it?

Bootloader on ATMEGA64M1

I'm wondering if, using a different driver file instead of mcp2515.cpp and mcp2515.h, I can port the project on the ATMEGA64M1.

That's my uC used on all my canBus project.

How can I proceed?

Because I don't see the .hex file for programming

Thanks in advance

Works like charm! Thanks a lot!

Hi Peter,
thanks a lot for sharing this. Its exactly what I was looking for.

I'm pretty new to platform.io and CAN on AVR and Raspberry Pi. So it took me some hours to make all of this run properly.

I just thought I could contribute some of my experiences I had during the setup process. Maybe this makes it easier for others to use this.

In my environment I'm using an atmega328p and an AVR ISP MK2 for flashing.
The following platformio settings worked for me

[env:ATmega328P_via_AVRISP_mkII]
board = ATmega328P
build_flags =
  ${env.build_flags}
  -Wl,--section-start=.text=0x7000 ; 2048 words bootloader, 0x3800 * 2

board_build.f_cpu = 16000000L

board_fuses.lfuse = 0xFF
board_fuses.hfuse = 0xD8
board_fuses.efuse = 0xFC

platform = atmelavr
framework = arduino
upload_protocol = custom
upload_port = usb
upload_flags =
    -C
    ; use "tool-avrdude-megaavr" for the atmelmegaavr platform
    ${platformio.packages_dir}/tool-avrdude/avrdude.conf
    -p
    $BOARD_MCU
    -P
    $UPLOAD_PORT
    -c
    stk500v2 ; avrispmkII
upload_command = avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i

; to flash the fuses run "platformio.exe run --target fuses --environment ATmega328P_via_AVRISP_mkII"

Maybe you can/want to add it to the platformio.ini file?

Additionally I used successfully this CAN adapter on the raspberr pi:

https://www.amazon.de/Konverter-Raspberry-Computer-Support-USB2CAN-C/dp/B09K3LL93Q/
Together with the helpfull infos from your page here: https://crycode.de/can-bus-am-raspberry-pi

Additionally I had to update node js on my pi to version 12.
For this I used NVM: https://github.com/nvm-sh/nvm
Executed this script on my pi: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
To install nodejs 12 using this command: nvm install 12 (make sure to perform a relogin into your bash otherwise the command nvm will not be known after install of nvm)

After that I was able to follow the instructions here: https://github.com/crycode-de/mcp-can-boot-flash-app
to install the flash app.

Some other thing I noticed:
First I tried to flash a huge hex file (about 29214 bytes). Of course this didnt fit into the flash together with the bootloader. The app on the raspi showed as error message
"Flash address error! Maybe the hex file is not for this MCU type?"
Maybe its possible to add here an additional hint that this could also be caused by a to large application? :)

Nevertheless, awesome tool and thanks again for sharing!

Ah btw. do you mind if I try to port the flash application to an ESP32? In my usecase I have an ESP32 on the same CAN bus together with some other AVRs and (just for in case) it would be awesome to flash the AVRs via the ESP32.

Thanks and best regards
Fabian

Different Value Of Extended Fuse Required On Atmel

Dear all,

Thank you for the lovely project you have created.

My device is Arduino Uno R3 with microcontroller Atmel ATmega328P.

With the fuse settings in platformio.ini, flashing over CAN does not work.

[env:ATmega328P] board = ATmega328P build_flags = ${env.build_flags} -Wl,--section-start=.text=0x7000 ; 2048 words bootloader, 0x3800 * 2 ;board_fuses.lfuse = 0xFF ;board_fuses.hfuse = 0xD8 ;board_fuses.efuse = 0xFC

For the fuse "efuse", I had to use the value "0xFD" for the flashing over CAN to work.

Atmega32U4

Hi Peter,

Can I use this bootloader on Atmega32U4 micro controller? it is connected to MCP2515 and TJA1050T as can transceiver.

Thanks

Not working on Arduino Nano?

I flash the boatloader via PIO and an Arduino Mega as ISP. But on my RPI i dont see any Action on CAN Bus. The flash App will also not work. Can you give an Example how to flash an Arduino Nano 328p over CAN and How to install the Bootloader on it ?

Thanks.

Read MCU_ID in program

Is it possible to read MCU_ID in uploaded program, when bootloader was flashed with fixed MCU_ID value set in config.h or should I reflash it to read MCU_ID from eeprom?

I'd like to use MCU_ID in program as can message ID.

Flash data error! Maybe there are some CAN bus issues?

Hello Peter!

Firstly, I would like to thank you for this project. I think that it is very helpful for many people.

However, I would like to ask you for help at solving one problem with flashing Arduino Nano (ATmega328P) with *.hex file.
Maybe I'll go into too much detail, but I think it will help other guys who are facing the same problems to solve them faster.
Arduino Nano(MCU) and RPi (Flasher) are connected through the MCP2515

  1. I installed Arduino as ISP sketch on Arduino Uno and connected it to the Arduino Nano:
UNO - NANO
D13 --> D13
D12 --> D12
D11 --> D11
D10 --> RST
5V --> 5V
GND --> GND
  1. I connected one led to the D7 and added to the config.h:
#define LED      PORTD7
#define LED_DDR  DDRD
#define LED_PORT PORTD
  1. Then I uploaded bootloader.cpp (as I understand) to the Arduino Nano by the "Upload" button in the Project Tasks of the PlatformIO project.
    image
    In fact, the command looks like:
    C:\Users\USER\.platformio\penv\Scripts\platformio.exe run --target upload --environment ATmega328P

  2. The LED is not blinking.

  3. I set fuses using button from Project Tasks:
    image
    In fact, the command looks like:
    C:\Users\USER\.platformio\penv\Scripts\platformio.exe run --target fuses --environment ATmega328P ...
    Selected fuses: [lfuse = 0xFF, hfuse = 0xD8, efuse = 0xFC]
    ...

  4. Nothing happens with LED.

  5. Output of the command on the Flasher side
    npx mcp-can-boot-flash-app -f firmware.hex -p m328p -m 0x0042
    is
    Waiting for bootloader start message for MCU ID 0x0042 ...
    And nothing happens.

  6. I upload bootloader again (p.3). The led is blinking 3 times in a row with small pause, then comes bigger pause and whole process repeats. Looks like it's waiting for flashing.

  7. Output of the command on the Flasher side
    npx mcp-can-boot-flash-app -f firmware.hex -p m328p -m 0x0042
    is different every time but everytime flashing stops around 10-15% after several messages
    "Flash data error!
    Maybe there are some CAN bus issues?"
    image

  8. I can not start the command again till I restart CAN bus. Also, "ifconfig" command on the Flasher side shows that there is a TX problem on the CAN bus. After restarting CAN bus, I can run the command again but the result is the same as in p.8.

Could you please tell me, what I am doing wrong?

ATMEGA 328PB support?

Hi, i was wondering what changes are needed to support the ATMEGA 328PB?

When uploading the 328P bootloader to a 328PB chip it doesn't seem to work...

i checked the pinout, the 328P is almost the same as 328PB, and these values in controller.h are correct also for 328PB

#define IV_REG MCUCR

#define SPI_DDR DDRB
#define SPI_PORT PORTB
#define SPI_SS 2
#define SPI_MOSI 3
#define SPI_MISO 4
#define SPI_SCK 5

Do i need to alter some values? or have i overlooked it?

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.