4. Running The Demonstration Example

This section describes the steps required to prepare the Pro DevKit and other tools to successfully run the example code. A serial terminal, an MPC4822 DAC module, a digital multimeter, and optionally a logic analyzer are required for testing and verifying the code. In addition, a breadboard and a few jumper wires are required to connect the SPI module to the Pro DevKit. If you are not familiar with the recommended process on how to clone a project or configure a serial terminal, read the Starting a Project tutorial.

There are two main methods to verify the correct behavior of the demonstrated code. The first method is to use a Serial Terminal and the second is to use a logic analyzer. Both cases are given below as a logic analyzer can be quite an expensive tool.

4.1. Verifying with a Serial Terminal

  1. Establish a connection between the target device and your PC through the USB1 port of the motherboard. This port is used both for powering and communicating to the DA1469x SoC. For this tutorial a Pro DevKit is used.

  2. Import and then make a copy of the freertos_retarget sample code found in the SDK of the DA1469x family of devices.

Note

It is essential to import the folder named python_scripts to perform various operations (including building, debugging, and downloading).

  1. In the newly created project and under the project’s /config folder you should create the following three files: platform_devices.c, platform_devices.h and peripheral_setup.h.

'Creating new files'

Figure 5 Creating New Files

  1. Place the project’s /config folder in the compiler’s include path. To do this, select Project > Properties > C/C++ Build > Settings > Tool Settings > Cross ARM C Compiler > Includes and click on the Add… icon (1.6).

'Include New Folder 1'

Figure 6 Add the New Folder to the Include Search Path

In the Add directory path window, click Workspace… and specify the path of the folder. It will be displayed in the Directory section. Click OK and then click OK in the previously opened window (1.7).

'Include New Folder 2'

Figure 7 Input New Folder Name

  1. Make sure the compiler does not generate errors instead of warnings. To do this, select Project > Properties > C/C++ Build > Settings > Tool Settings > Warnings and deselect the corresponding tick box. Finally, click OK.

'Configure Compiler's Warnings'

Figure 8 Configure Compiler’s Warnings

  1. In the target application, add/modify all the required code blocks as illustrated in the Code Overview section.

Note

It is possible for the defined macros not to be taken into consideration instantly. Hence, resulting in errors during compile time. If this is the case, the easiest way to proceed with is to: right-click on the application folder, select Index > Rebuild and then Index > Freshen All Files.

  1. Build the project either in Debug_QSPI or Release_QSPI mode and burn the generated image to the chip.

  2. Connect the DAC module to the Pro DevKit. Figure 9 illustrates the pin connections required to configure the MCP4822 module. For more information on the DAC module used, read the manufacturer datasheet.

'Configuring the MCP4822 DAC Slave Device'

Figure 9 Configuring the MCP4822 DAC Slave Device

  1. Connect a digital multimeter to VoutB pin of the DAC module.

  2. Press the RESET button on Pro DevKit. This step starts the chip executing its firmware.

  3. Open a serial terminal (115200, 8-N-1) and press the K1 button on Pro DevKit. A debugging message is displayed on the console indicating the status of the current SPI operation as well as the data (2 bytes) sent to the DAC module. The analog output value of the selected DAC channel, by default channel B, should be changed randomly.

'Debugging Messages Indicating the Status of an SPI Operation'

Figure 10 Debugging Messages Indicating the Status of an SPI Operation

4.2. Verifying with a Logic Analyzer

This step is optional and is intended for those who are interested in using an external logic analyzer to capture the SPI signals during a transaction

  1. With the whole system up and running, open the software that controls the logic analyzer. For this step a logic analyzer from Saleae Incorporation and its official software was used.

  2. Connect the logic analyzer to the Pro DevKit. To do this, you should:

    1. Connect a channel from the logic analyzer to P0_28 pin of Pro DevKit. This is the Clock signal (SCK).

    2. Connect a channel from the logic analyzer to P0_26 pin of Pro DevKit. This is the Master Output Slave Input signal (MOSI).

    3. Connect a channel from the logic analyzer to P0_29 pin of Pro DevKit. This is the Chip Select signal (CS).

  3. Press the K1 button on Pro DevKit and capture the SPI write operation.

'SPI Write Transaction as Captured Using a Logic Analyzer.'

Figure 11 SPI Write Transaction Captured using a Logic Analyzer.