Code Monkey home page Code Monkey logo

can-opener's Introduction

๐Ÿฅซ๐Ÿ”“ Can Opener

Can Opener is an open source cross platform firmware application that implements the Lawicel slcan (Serial CANBUS) protocol using libhal and its ecosystem.

Currently this project only supports SparkFun's MicroMod boards.

Any MicroMod board should work so long as it implements the following APIs:

  • hal::micromod::v1::can: Used to communication over CAN.
  • hal::micromod::v1::led: Used as an indicator in the application.
  • hal::micromod::v1::console: Used to communicate over serial to a host device
  • hal::micromod::v1::uptime_clock: Used for telling time
  • hal::micromod::v1::reset: Used to reset the device

๐Ÿš€ Installing Firmware via prebuilt binaries

We provide prebuilt binaries for each of our releases. You can use these to program your microcontroller with the CanOpener firmware.

Note

We plan to eliminate this flow once the CanOpener website supports flashing devices. The aim is to provide an "hardware update" button that will flash your device for you. It would present a screen that provides a list of all of the released versions and allow the user to select which one they want to install or simply install the latest..

Steps to upgrade firmware are:

  1. Connect CanOpener device to computer using a USB cable.
  2. Download CanOpener/0.0.0.
  3. Program the device by using the stm-serial-flasher website.
    1. To use this website, click "Select Port"
    2. Then click "Pair New Port" and look for a the serial port for your device. It should have a name like COM8, /dev/ttyUSB2, /dev/ttyACM1, or /dev/tty.serial-1100.
    3. Click the "x" to close the modal screen.
    4. Click "Connect".
    5. Click "Open File" and navigate to where the file was downloaded select it.
    6. Now click "Flash" and wait for the board to be flashed.
    7. Click disconnect.
  4. Now go to the CanOpener website and connect your device to the website.
  5. You are done ๐Ÿ˜„

Warning

If you are not using a CanOpener USB to CAN adaptor board and you are using your own board, then make sure to have the can transceiver connected. Without it connected, some CAN peripherals may hang at initialization and may hang when attempting to transmit a message. If you're device is not working with the CanOpener website, consider checking the state of your CAN transceiver IC or board.

๐Ÿ—๏ธ Building the Application

libhal applications use the Conan package manager. To use libhal you will need to install conan. Conan and libhal will handle installing the appropriate compiler and build systems for you. No need to install them yourself.

Follow the "๐Ÿš€ libhal Getting Started" guide and stop when you reach "๐Ÿ› ๏ธ Building Demos". Come back to this page to continue the build steps. The link to the guide is here.

Download the MicroMod profiles using:

conan config install -sf conan/profiles/v1 -tf profiles https://github.com/libhal/libhal-micromod.git

Download the ARM GCC profiles:

conan config install -tf profiles -sf conan/profiles/v1 https://github.com/libhal/arm-gnu-toolchain.git

To build for the stm32f1 MicroMod v4:

conan build . -pr mod-stm32f1-v4 -pr arm-gcc-12.3 -s build_type=Debug

To build for the lcp40 MicroMod v5:

conan build . -pr mod-lcp40-v5  -pr arm-gcc-12.3  -s build_type=Debug

Caution

The Release version of the binary doesn't seem to work well so users should stick to the Debug version until this notice is removed.

๐Ÿ’พ Flashing your Board via command line

Important

Make sure to replace the --device and port -p (examples uses /dev/tty.usbserial-100) serial device paths and names to the correct ones for your platform.

For the lpc40 v5 board:

nxpprog --device /dev/tty.usbserial-100 --control --cpu lpc4078 --binary build/micromod/mod-lpc40-v5/Debug/app.elf.bin

For the stm32f1 v5 board:

stm32loader -p /dev/tty.usbserial-100 -e -w -v -B build/micromod/mod-stm32f1-v4/Debug/app.elf.bin

For the stm32f1 v4 board:

stm32loader -p /dev/tty.usbserial-100 -e -w -v build/micromod/mod-stm32f1-v4/Debug/app.elf.bin

can-opener's People

Contributors

kammce avatar

Stargazers

Jordan Williams avatar

Watchers

 avatar

can-opener's Issues

Add full support for version command

Currently the version command just return V0000 but it would be nice to somehow support a version for the firmware. Maybe the conan script + cmake script + macro could be used.

But it also makes sense that this particular project may turn into an application package, meaning one could bring this into their own application as an additional app that runs in their code. That application package would have a version and that version would be used for the version command. That version would be baked into the project via the conanfile.py + cmake script + some macro that the source code uses to generate the version string.

Bit 6 Arbitration Lost (ALI), see SJA1000

See page 8 of the usb can manual. Although this may not be a useful flag because arbitration loss can happen to often that it may be hard to detect. We may just keep this flag always zero because our can drivers typically attempt to retry if they are not acknowledged.

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.