![]() | ||||
So you want to create an MRBus node. The easiest way to start is based on one of the template projects - basically an easy outline that can be copied and critical sections filled in to make a fully functional component. Step 0 - Get the ToolchainYou'll need some sort of gcc-based AVR toolchain in order to build the projects. If you're already doing AVR development, chances are you'll already have these things set up. Under Debian-based Linux distros (Debian, Ubuntu, Mint, etc.), you'll typically need packages With Windows, it should be possible to build things using the popular but dated WinAVR package or a more updated version, like MHV AVR Tools. Step 1 - Get the Template ProjectAt the moment, there's only an AVR template project. If there's ever future demand, a PIC version could be created. The AVR template project can be found in subversion here:
SVN?: Tip: You're probably really not going to want all the subversion? stuff in your mrb-avrtemplate directory. After all, you're going to change this into a new project, and probably put it under a new name and your own version control. So you're probably going to want to use " This will create a directory structure that consists of the following: mrb-avrtemplate/ src/ src/Makefile src/mrb-avrtemplate.c Step 2 - Get the MRBus Core LibraryOf course you'll also need a copy of the core library. The best place to get this is again from our subversion? archive. If you already have this, then don't worry about step 2. SVN?: Put that at the same level as your mrb-avrtemplate directory, so you'll now have something like: mrbus/ src/ src/mrbus.h src/mrbus-crc.c src/mrbus-avr.c src/mrbus-avr.h src/mrbus-pic.c src/mrbus-pic.h mrb-avrtemplate/ src/ src/Makefile src/mrb-avrtemplate.c Go into your mrb-avrtemplate directory and type "make hex". If it all passes and creates a mrb-avrtemplate.hex file, you're good to go. Step 3 - Rename Your ProjectWell, come on, you're not making a new template, you're making a real node. So to thoroughly rename your project:
Step 4 - Set up Your HardwareThe actual construction of basic MRBus hardware with an AVR core is pretty simple. At a bare minimum, you need:
(Fixme: insert basic 485 / AVR connection schematic here.) Once you get your shiny new AVR on your breadboard and wired up, you'll need to adjust the Makefile to match your hardware target. Things to change:
Step 5 - Write Your Node ApplicationAs it is, the mrb-avrtemplate project should be able to respond to pings? and eeprom read? and write? requests. (The example template reads its MRBus address from EEPROM address 1, so don't forget to program it with something sane.) At the very least, visit all of the sections in the code with a FIXME comment - these are generally the parts of the template people add things to.
Tip: The MRBus Core Library Reference documents the defined behaviour of MRBus library functions and variables. Basically anything with "mrbus" in the name gets described here. That said, the most obvious question is "What the heck does this stuff do?" The easiest way to understand it is probably to walk through how the template project was built. |
||||
|