If you want to try out the Freemodbus stack for the Atmel SAM3S line of microcontrollers, you’ll run into difficulty when following the instructions to do so in app note 11098, “Modbus Slave Stack for the Atmel Family of SAM3 Microcontrollers.” Here’s why:
- The app note was written in March 2011 and is largely outdated when you try to integrate the code into a modern ARM IAR dev stack.
- The code was written for the SAM3S-EK dev board, which is no longer available. It has been superseded by the SAM3S-EK2, although I should note that I was able to get the EK2 to run the code for the EK with most of the functionality intact.
I worked my way through the migration process to modernize the example. So, to get running smoothly, you’ll need to do the following. These instructions are essentially the same as those in the app note except I am providing updated files and projects.
- Install an appropriate IAR Embedded Workbench for ARM. I have the free, size-limited version 8.20.2.
- Install the Atmel support libraries. Instead of using version 5.5 in the appnote, use the 6.20 version available here. That link goes to microchip support, so in case it dies, I am hosting a copy available at this link. You must merge the contents of the .rar archive with your IAR installation, probably at this file path: C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.0\
- Instead of using the freemodbus zip archive referenced by the app note, use this one instead. Place the contents under the examples\Atmel\sam3s\sam3s-ek2\ directory, not the sam3s-ek directory like the appnote instructs.
That’s it. You should be able to open the demo.eww workspace in IAR. the demo, libboard, and libchip projects have all been updated to use the EK2 software stack, and corrections were made so that CMSIS is used instead of some of the files included with the demo code.