Skip to content

Paolo-Maffei/Freebus-avr

Repository files navigation

/** @mainpage
\tableofcontents

\section fuses-168 Setting Fuses for ATMega168(P)
Warning, this controller type is not supported anymore. Use the 328P(A) instead.

Boot Rom not used<br>
SPIEN=on<br>
BODLEVEL=Brown-out detection at VCC=2.7V<br>
SUT_CKSEL=Ext. Crystal Osc. 8.0- MHz; Start-up time: PWRDWN/RESET: 1K CK /14<br>

EXTENDED=0x01<br>
HIGH=0xDD (eeprom not preseved through chip erase), or 0xD5 (eeprom preserved)<br>
HIGH=0xCD or 0xC5 (as above, but watchdog enabled)<br>
LOW=0xCF (crystal oscillator), or 0xC0 (external clock from RFM22)<br>

\section fuses-328 Setting Fuses for ATMega328P(A)
This is the suggested microcontroller which have enough size to support the bootloader mode.

Boot Rom not used<br>
SPIEN=on<br>
BODLEVEL=Brown-out detection at VCC=2.7V<br>
SUT_CKSEL=Ext. Crystal Osc. 8.0- MHz; Start-up time: PWRDWN/RESET: 1K CK /14<br>

EXTENDED=0xFD<br>
HIGH=0xD9 (eeprom not preseved through chip erase), or 0xD1 (eeprom preserved)<br>
HIGH=0xC9 or 0xC1 (as above, but watchdog enabled)
LOW=0xCF (crystal oscillator), or 0xC0 (external clock from RFM22)<br>

\section compile Compile and create HEX files
To compile your self developed applications or compile already existing ones you have:
- \ref compile-windows "for Windows with Atmel Studio 6 you must create a project as described"
- \ref compile-linux "for Linux/Unix/MacOSX Makefiles are available"

\subsection compile-windows Windows
Read avr-atmel-studio-project-anlegen.pdf and start-avr.pdf manual.
Make sure to always defined the compile switch -DF_CPU=8000000UL and which connection and hardware is used:<br>
<br>
<b>Compiler defines in your own application</b><br>
In order to select the right library and CPU frequency, you should define<br>
<b>-DFB_TP</b> freebus (twisted pair) device<br>
<b>-DFB_RF</b> freebus-rf device<br>
<b>-DFB_TP -DFB_RF</b> device with both, twisted pair and rf, this applies for a gateway<br>
<b>-DFB_TP -DBOARD301</b> for the old Rev 3.01 board (twisted pair, of course)<br>
if you use GNU make you can set the variable CUSTOM_CFLAGS in your application's Makefile.<br>

\subsection compile-linux Linux/Unix/MacOSX
If you use the existing Makefile structure you must not care what compile options must be set and you must not define which library to link to, the Makefiles will do everything for you.
You must say the Makefile only for which processor, media type and hardware you want to build the hexfile.<br>
To do this, copy the Make.config.template to Make.config and set the first 3 options. See \ref firmware for an explanation of the options.<br>
To create all .hex files you can type in the main directory:<br>
make hex<br>
you will find your hex file in the application folder like app-8-out/freebus-avr-8-out_(MCU)_(MEDIATYPE)_(REVISION)(DEBUG).hex


\section notes General notes if developing your own application:
If you develop an application you should not use an ISR in that application it can disturb the extreme
critical timing in the EIB bus communication. I you need timers you should check instead registers if a
special event was triggered. If you absolutely cannot avoid the use of ISRs make sure that they run as short as possible
and check every condition you can imagine that it is secured that the bus communication is handled correctly.<br>
Transfers which a very error phrone are:<br>
- ACKS sent and received (at the end of a telegram)<br>
- Long communication like programming of group addresses and parameters<br>
- Receiving of data while a bit is read<br>

The following functions must exist in each application (take as example fb_relais_app.c):
- \link fb_relais_app.c#app_loop(void) app_loop(void)\endlink<br>
- \link fb_relais_app.c#restartApplication(void) restartApplication(void)\endlink<br>


\section firmware Firmware to link to
We have several libraries available. Which one has to be used depends on the hardware you use.
The nameing convention is:<br>
libfb_(MCU)_(MEDIATYPE)_(REVISION)(DEBUG).a<br>

MCU              | Description
---------------- | -----------
atmega328p       | Atmel ATMega 328p MCU

MEDIATYPE        | Description
---------------- | -----------
tp               | Twisted pair mode (only connected to KNX bus with twisted pair)
rf               | Radio frequency module connected, not connected to KNX
tprf             | Radio frequency module and KNX connected (gateway)

REVISION         | Description
---------------- | -----------
1                | AVR controller board with hardware revision 3.01
2                | AVR controller board with possibility to connect radio frequency module (current board)

DEBUG            | Description
---------------- | -----------
debug            | With debugging enabled (use with care, it can make problems with timing). It prints information to rs232 interface.
\<empty>          | Debugging is disabled (should be used to build stable hex files)
                 
\subsection example Examples
<b>libfb_atmega328p_tp_2debug.a</b><br>
MCU=atmega328p (build for mcu Atmel ATMega328p)<br>
MEDIATYPE=tp (connected only to KNX bus)<br>
REVISION=2 (AVR controller board with radio frequency option)<br>
DEBUG=debug (debugging is enabled)<br>
<br>
<b>libfb_atmega328p_tp_2.a</b><br>
Same as first example, but with no debugging enabled.

@todo complete list of conditions that must be checked

*/

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •