Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

SimplePublish for SAM C21 Xplained Pro

...

Note

Windows is the only supported OS for the latest Atmel Studio 7.

Tip

ASF is included in Atmel Studio 7 and does not require a specific download, but you can use the Extension Manager (Tools->Extension Manager) to update it.

Prepare the SAM C21 Xplained Pro

...

Although the provided code is written specifically for the ATSAMC21J18A on the SAM C21 Xplained Pro evaluation kit, it should be pretty straightforward to port it to similar architectures that support the same ASF modules. Correctly configuring the available serial ports (SERCOM USART) in serial.c/.h should be the only thing that might require some adaptation. We therefore give a quick guide on how to set up a new ASF project.

...

  1. In the Soution Explorer window (right side), right click the folder src > Add > New Folder
  2. Name it sm_clib
  3. Right click the folder you just created > Add > Existing Item...
  4. Navigate to the C Library directory in the repository: sm_clib/sm_clib/
  5. Select all the .c and .h files, except those for the manager/wireless heart:
    dn_ipmg.c/.h
    dn_serial_mg.c/.h
    dn_whmt.c/.h
  6.  Click the down-arrow next to Add and select Add As Link
     
  7. Repeat the same steps with an sm_qsl folder for the QSL (but this time, add everything in sm_qsl/)
  8. Restart Atmel Studio and reopen your solution/project.
    The two directories with the linked files will now have been moved to a subdirectory with the same name as your project.

    Info

    If you don't restart, you will later see that building the project fails: Inspecting the autogenerated makefile unveils that Atmel Studio attempts to build object files for the linked files in the non-existing subdirectory. Attempting to correct the makefile is futile, as Atmel Studio overwrites any manual changes. This seems to be a bug that only happens with files that are added "... As Link", but does not seem to have any other effects than the need for a restart and tolerating the unnecessary sub-directory in the Solution Explorer.

Add QSL and C Library Directories to Toolchain

  1. In the Soution Explorer window (right side), right click your project > Properties (Alt+F7)
  2. Toolchain > ARM/GNU C Compiler > Directories
  3. Press the  icon and then the (...) button
  4. Again browse to the C Library in the repository: sm_clib/sm_clib/ and press Select Folder

    Note

    Make sure that you add a relative path to sm_clib/sm_clib/ and not just the top sm_clib/ directory.

     

  5. Press OK.

  6. Repeat the previous steps for the QSL in the repository: sm_qsl/

  7. Press Ctrl+S to save your changes

Create folder

Add as link

Add to Directories in Toolchain

Restart Atmel Studio (Directory Bug...)

Make necessary adaptationsMake necessary adaptations

Finally, you need to dive into the serial port configuration in serial.h and serial.c and make any necessary adaptations. Consult the datasheet of your platform for details (look for SERCOM USART).