Menu

Port library to atmega328p (arduino) with bacnet/IP

2013-04-24
2016-12-08
  • Miguel Fernandes

    Hello,

    I would like to compile the library to the atmega328p chip (for the arduino) using the bacnet/ip for communication.

    I have started to look at the port/atmega168 folder but some of the options namely hardware.h, avr035.h and iar2gcc.h i have no clue if need and what to modify or which files to use for the specific chip.

    Another issue is to implement the bip.h & bip.c to use the a arduino library with similar functions. Does anyone has gone down this path or has suggestions?

    Thanks in advance.
    Cheers,
    Miguel

     
  • Miguel Fernandes

    Hello,

    Anyone?

    When trying to compile the port just by changing the mcu type from atmega126 to atmega328p in the Makefile. The error defined in hardware.h comes up. Can anyone point out which modifications are necessary in the hardware definition to compile for the atmega328p?

    Thanks.
    Cheers
    Miguel

     
  • Steve Karg

    Steve Karg - 2013-05-02

    Hi Miguel,

    If you are using Ethernet or BACnet/IP datalink layer of BACnet, there is no need to use the any of the ports to AVR. The ports to AVR just use AVR for timer interrupt and UART for BACnet MS/TP. The hardware files are just for making it work to read DIP switches (for the MS/TP MAC address) or light LEDs (for MS/TP Tx and Rx indication, or to turn on status LED).

    For an Ethernet (not BACnet/IP) datalink layer, you could port the ethernet.c from ports/linux/ethernet.c to whatever the Arduino library gives you, and then pick and choose the other core files and handlers as needed.

    For BACnet/IP (UDP/IP), you could port bip.c from ports/lwip/bip.c to whatever the Arduino library gives you for access, assuming it is not sockets. If it has sockets, you could use the standard src/bip.c and create your own bip-init.c like in ports/linux/bip-init.c file.

    The other core files and handlers needed are detailed in the doc/README.developer, but you can use one of the Makefile in ports/ as a guide to which files are needed on a minimal build.

    I have an Arduino and an Ethernet shield (wiznet), but haven't had any time to play or make an Arduino library for BACnet. I'll be traveling to San Francisco next week for BACnet committee meetings; maybe I'll have free time in the evening to play.

    Best Regards,

    Steve

     
  • Miguel Fernandes

    Hello Steve,

    I have ported the example application atmega168 to the Arduino/ethernet shield with W5100 chip.

    Apart from the bip.c and bip-init.c it was necessary a strip down version of bvlc.h and bvlc.c and it was necessary a C wrapper for the Arduino ethernet library since it was developed in C++. For the application is also necessary the Arduino core library which i only have the binary version taken from a compilation cycle of the arduino IDE.

    I am more than happy to share the implementation if interested. If so i just wait instructions on how it can be done.

    Cheers,
    Miguel

     
  • Steve Karg

    Steve Karg - 2013-07-03

    Hello Miguel,

    Nice to hear about your hard work on Arduino! I would be happy to add your port to Arduino in the source tree if you want to share. You can create a Feature Request, and attached a patch (or just a zip archive of the files that you added or changed):
    https://sourceforge.net/p/bacnet/feature-requests/new/

    Best Regards,

    Steve

     
  • Matt

    Matt - 2016-12-08

    Hi Steve,

    If I were to port to atmega328p, what would I need to change from the atmega168 port?

     
    • Steve Karg

      Steve Karg - 2017-02-10

      Generally: rs485.c, timer.c, main.c, hardware.h

       

Log in to post a comment.