Coder Social home page Coder Social logo

stm32-car's Introduction

stm32-car

This firmware is a hacky mishmash of VW and Nissan CAN code. It talks to the Nissan BMS (aka LBC) to find out cell voltages and such. It also produces all messages needed for satisfying the various controllers in newer VW cars (my testbed is a 2004 Touran). That means all warning lights are off.

Features

  • Send all messages necessary to make the DSC light go off
  • Fake the oil pressure sensor depending on motor rpm
  • Map the electric motor speed onto the speed dial
  • Map the electric motor temperature onto the temp dial
  • Map the momentary electric power onto the fuel economy display
  • Read key switch, brake switch and cruise control buttons from CAN bus
  • Read brake vacuum sensor and control vacuum pump
  • Read throttle pedal and put it on the CAN bus
  • Read individual cell voltages from Nissan Leaf BMS
  • Read SoC, SoH etc. from the Nissan Leaf BMS
  • Control inverter charge mode depending on battery state
  • Control analog fuel gauge via two current source channels

CAN configuration

Not all CAN messages are hard coded, some are configured via the generic interface. The parameter names are strange, as I just used some left over stuff from the inverter firmware. Send these commands:

  • can tx pot 1 0 16 1 //this is for the inverter, configure however you want
  • can tx pot2 1 16 16 1 //this is for the inverter, configure however you want
  • can tx canio 1 32 6 1 //this is for the inverter, configure however you want
  • can tx speedmod 640 16 16 4 //speed dial with simulated idling engine so that power steering works
  • can tx din_forward 640 0 8 1 //apparently needed this constant
  • can tx tmpmod 648 8 8 1 //temperature dial
  • can tx turns 644 0 8 32 //copy from message #80
  • can tx turns 644 8 8 32 //copy from message #80
  • can tx din_forward 896 8 8 101 //apparently needed this constant
  • can tx din_forward 896 56 8 17 //apparently needed this constant
  • can rx din_start 1394 3 1 32 //grabs key switch start position
  • can rx din_brake 416 11 1 32 //grabs brake light switch
  • can rx din_forward 416 14 1 32 //some bit that is always 1
  • can rx opmode 2 0 3 32 //various inverter values
  • can rx udcinv 2 16 16 8
  • can rx tmpm 2 48 8 32
  • can rx speed 2 32 16 32
  • can rx turns 80 20 4 1 //grabs sequence from canbus

Compiling

You will need the arm-none-eabi toolchain: https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads The only external depedencies are libopencm3 and libopeninv. You can download and build this dependency by typing

make get-deps

Now you can compile stm32-sine by typing

make

And upload it to your board using a JTAG/SWD adapter, the updater.py script or the esp8266 web interface

stm32-car's People

Contributors

jsphuebner avatar

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.