Code Monkey home page Code Monkey logo

bcm-hv's Introduction

bcm-hv

Library for Vicor's BCM4414 DC/DC regulator. There is a separate folder for Arduino and STM32F4.

Background

Many EV Formula Student teams use 600V tractive system voltage. The higher the voltage, the thinner the cables. To power the low voltage electronics you can do either of 2 things.

  1. A separate low voltage battery pack.
  2. A DC/DC regulator. (Usually 12V or 24V).

It is difficult to find a rule compliant regulator. One such regulator is Vicor's BCM4414.

The purpose of me open sourcing this git repository is to help other Formula Student teams get started with creating the code. I am myself in University of Iceland's Team Spark team but this project developed for another course outside my team.

The BCM4414 module I had to test and write this code is an engineering prototype and it doesn't have all the functionality as the newest modules. Though it should be easy to add to the code. All reading and writing functionality has been fully tested.


Hardware connection

External pull-ups are required to get good signal edges. You can use either 3.3V or 5V, either works fine.

You can choose your own ADDR resistor value (R3) by looking up the table in the datasheet. Using 1000 Ohms as depicted below yields a device address 0x51.

Usage

Arduino

The code is located in Arduino/src/

Start by creating an instance of the class Vicor. It takes two inputs, a TwoWire instance and an I2C address (see Device Address in BCM datasheet). You can choose whether you want to use the your own TwoWire instance or not, the Vicor class will create one for you.

// Method 1
Vicor bcm;       // Not inputs. The instance uses default settings.

// Method 2
Vicor bcm(0x51); // Custom I2C address 0x51.

// Method 3
TwoWire pWire;           // Custom Wire class for I2C
Vicor bcm(&pWire, 0x51); // Custom I2C address 0x51 and TwoWire instance.

STM32F4

The code is located in Nucleo-F401RE/src/

I had trouble using C++ so I've stuck with C. That means I can't use the class method I used for the Arduino.

Start by declaring an instance of the global struct like this:

BCM4414 bcm; // Global BCM variable.

This struct includes all the data possible to get out of the modules.

You must manually call the other functions included in vicor.c to specify which data to get. The data is stored in the BCM4414 struct.

Example: Status CML

read_status_cml(&hi2c1); // Read Status CML byte from the BCM module.

// You can either get the entire byte in one:
bcm.status_cml.all // <-- raw byte (includes all bits)

// Or you can go further and read individually defined bits:
bcm.status_cml.cmd_stat_rx  // <-- 0 or 1 for bit 7
bcm.status_cml.data_stat_rx // <-- 0 or 1 for bit 6

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.