Versions Compared

Key

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

SimplePublish for SAM C21 Xplained Pro

The QSL includes a SimplePublish example for the Atmel SAM C21 Xplained Pro evaluation kit. This is given as an Atmel Studio 7 project based on the Atmel Software Framework (ASF). The main.c code itself is similar to the one for RPi, with the addition of a watchdog timer and initialization of a second serial port to enable debug prints (the watchdog is for demonstration purposes only, and can be removed as the user see fit).

Although the 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 since the ASF is used. Correctly configuring the available serial ports (SERCOM) in serial.c/.h should be the only thing that might require some adaptation.

...

Info

The example was developed on Atmel Studio Version 7.0.1006 with ASF version 3.32.0.

Download Atmel Studio 7

Download and run the Atmel Studio web installer from the official download page, and follow the instructions. This will also install the necessary drivers for the embedded debugger on the Xplained Pro board.

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

...

The Xplained Pro has three extension headers (EXT1, EXT2, EXT3) with pins as listed in Table 1: Connect the mote to one of the headers as per the mapping in Table 2. In Figure 2 you can see the mote connected to EXT1, but it does not matter which one you use: The pins for UART RX/TX are all connected to the same pins on the SAM C21.

 

 

 

Warning

Long cables between the mote and Xplained Pro may corrupt the API bus communication.

...

The SimplePublish example code will send all standard input/output (e.g. debug prints) through the serial port you identified in the previous section. Open your favourite serial terminal (e.g. Putty) and connect to it with said serial port with the following configurationsconfiguration:

  • Baudrate: 115200
  • Data Bits: 8
  • Parity: None
  • Stop Bits: 1
Note

You probably have to restart the terminal whenever you disconnect/reconnect the debug USB to the Xplained Pro.

  

Compile and Run

Navigate to the SimplePublish example directory at examples/samc21_xplained_pro/SimplePublish and open the SimplePublish.atsln solution file in Atmel Studio 7. This should open the project with everything set up for you. Since the Xplained Pro has an embedded debugger, you do not have to select any tool. Atmel Studio should detect that the board is connected via USB.

Now, simply press the Image Added symbol (Ctrl+Alt+F5) to compile and run the program, and you should see prints appearing on the debug terminal you opened.