I do a lot of space developments, most of these are FPGA based however, often we include a radiation tolerant or hardened processor in the system. This processor can be used for communication, control and monitoring of the system.
Typically we use SAMRH71 or SAMV71Q21RT processors. The RH version is radiation hardened but comes with lower performance and unique foot print.
While the SAMV71Q21RT is available in a range of options and packages which makes it more interesting for some applications. It also runs at a higher clock frequency, which is good for increased performance.
When it comes to prototyping the SAMH71 there is a development board however, it is as you would expect strictly export controlled. We have looked at bring this up previously here.
If we are working with the SAM71Q21RT we can use a simple commercial development board for prototyping the SAM V71 XPLAINED ULTRA EVALUATION KIT.
So in this project we will examine how we are able to get a simple application up and running for the processor.
The flow is identical however for most of the SAM processors within the Microchip Range.
Development EnvironmentTo get this board up and running we will be using MPLAB IDE X with the XC32 compiler.
This is Microchip’s free development environment for PIC, AVR and SAM microcontrollers.
Using MPLAB X we can edit code, define the hardware configuration, compile and debugging an application.
Project Manager
The Project Manager is where your application lives. It shows all source files, headers, libraries, and configuration files in one place. From here you can build the project, clean it, or select which project is currently active. It acts as the main control centre for your firmware.
MPLAB Code Configurator (MCC)
MPLAB Code Configurator (MCC) is a graphical tool that simplifies hardware setup. Instead of manually configuring registers, you select and configure peripherals such as:
- GPIO
- UART, I²C, SPI
- Timers, ADC, and PWM
MCC then automatically generates initialisation and driver code, allowing you to focus on your application logic.
Pin Manager
Within MCC, the Pin Manager provides a visual view of the microcontroller pins. It helps assign peripheral functions, avoid pin conflicts, and give pins meaningful names such as LED_STATUS or SENSOR_INPUT, improving readability and reliability. This is similar to what we do in FPGA design, although the pins have more limited functionality.
MCC Content Manager
The MCC Content Manager works alongside MCC and allows you to download, update, and manage MCC libraries and device support packages. This ensures you are using the correct drivers and the latest peripheral libraries for your selected microcontroller. It is especially useful when starting a new project or targeting a new device.
Project CreationTo create a project is very simple in MPLAB IDE X.
We first start by creating a new project and select, Microchip Embedded, Application Project.
We then need to select the family of the device we wish to work with. In this case the SAM and select the exact device.
The tool will only be populated if we have the development connected to the development system.
The next step is to select the compiler, we will be using the XC32 compiler.
Finally select the project name and the project location.
This will create a new project in the MPLAB IDE X.
The next step is to open the MCC and configure the design, you will see on the left hand side the ability to select project resources and device resources.
Project resources are things such as a configuration for the development board we are using. While the device resources are the peripherals of the processor which we are able to work with.
The development board has a vitual com port which is connected to the USB debugger.
This VCP is shared with several different connectors on the development board.
For this project we will show how we can say hello world, using this over the USB.
Following this through, we can see this is connected to USART1, which we can add into the MCC Graph.
I identified it was connected to USART1 by looking at the options in the pin plug in.
Selecting the USART1 on the graph we are able to configure its behaviour. I will leave this unchanged.
The next step is to add in the STDIO block to the MCC graph.
To set the USART1 as the SDTIO we need to connect the UART output of USART1 to the STDIO.
The next step is to assign the pins in the pin assignment. The simplest way to do this is using the Pin Settings Tab. We need to set PA21 and PB04 to there USART features.
We can see the pins on the pin mapping change to be green on PA21 and PB04 to indicate they are now assigned.
The next step is to generate the software, as in the project explorer you will see, no source files currently.
Click generate in MCC.
This will take a few minutes to build.
The end result of this generate will be several source code files which we are able to add to.
Looking in the generated main.c we will see this is fairly simple, which is to be expected as we have not used any of the MCC Harmony elements via MCC Content Manager.
When it comes to applications we are able to create stand alone files which ensures they do not get replaced if we regenerate the MCC.
For this application we will create two files one called app.c and another called app.h which we can call from the main.
It is within these files we will implement our software application, though in this instance it is a simple one.
We can create a simple hello world application.
#include "app.h"
void main_app(){
printf("Hello World\r\n");
}Our header file becomes.
#ifndef _EXAMPLE_FILE_NAME_H /* Guard against multiple inclusion */
#define _EXAMPLE_FILE_NAME_H
void main_app();
#endif /* _EXAMPLE_FILE_NAME_H */I updated the main to include the header file and call the main_app().
#include <stddef.h> // Defines NULL
#include <stdbool.h> // Defines true
#include <stdlib.h> // Defines EXIT_FAILURE
#include "definitions.h" // SYS function prototypes
#include "../Bringup.X/app.h"
// *****************************************************************************
// *****************************************************************************
// Section: Main Entry Point
// *****************************************************************************
// *****************************************************************************
int main ( void )
{
/* Initialize all modules */
SYS_Initialize ( NULL );
while ( true )
{
/* Maintain state machines of all polled MPLAB Harmony modules. */
SYS_Tasks ( );
main_app();
}
/* Execution should not come here during normal operation */
return ( EXIT_FAILURE );
}We are then able to compile the source code, you should see this as being successful.
If you want to make any changes to the compiler or linker settings we can click on the project properties.
The project settings will also show resource usage on the target processor.
One of the nice things about this board is the ability to connect and debug over a USB connection and does not require an external debugger.
With the board connect we are able to download the application and see it running on the board.
This means we are able to now get started on more complex applications which make use of this processor. We can use this processor to communicate with the an FPGA using a protocol such as the one described in this project.
Wrap UpWhile this is a simple project, it outlines how to get started with the SAM series of processors.
We use these processors in several complex applications, such as the one shown below.




Comments