This example project demonstrates how to read and write to SD card module with Vega Aries using CASP. Please go through the SD card block documentation for selecting suitable SD card.

Target

Aries v2.0 development board is used in this project. However, any supported micro-controller board can be used.

Pre-Requisites

  • CASP software is installed on the host PC
  • Vega Aries BSP is installed.
  • The project files are located at CASP installed directory ‘CASP/support/examples/vega_aries_examples/hw_interface/09_sd_card’. These are also available for download at this link.

Connection Diagram

SD card module is connected to the target board as shown in the circuit diagram. Two separate models are developed to read and write integer values to the SD card. User shall enable only one model at a time. User may copy the sd_file.txt file from the project directory to the SD card for this demonstration.

SD card read model reads the numbers from the file, converts to respective integer value and outputs to PWM0 pin to vary its brightness based on the integer value. User can see the integer value read from the SD card from the ‘Configure Simulation Hardware’ interface window by clicking on Simulation->Configure Simulation IO menu item from the CASP main tool bar.

Similarly, the write model counts the number of pulses generated from the pulse generator and writes the count to the SD card file.

GPIO3 pin will be high if the SD card encounters errors during reading and writing. User may enable CASP serial debug feature and check for detailed errors. Please go through the individual block parameters used in the model along with respective documentation for better understanding.

Model

Procedure

  • Connect the peripherals as shown in above connection diagram and connect the target board to the host PC.
  • Launch CASP and open the downloaded project.
  • Click ‘Setup Simulation’ to open a dialog box.
  • Select ‘Target Programmer’ to ‘Programmer0’ to upload the program to RAM or ‘Programmer1’ to upload the program to flash memory of the target board.
  • Set the ‘Target Programmer Port’ to which the board is connected.
  • Save and Close the dialog box.
  • Click Run button to build and program the board.
  • User can see the integer value read from the SD card from the ‘Configure Simulation Hardware’ interface window by clicking on Simulation->Configure Simulation IO menu item from the CASP main tool bar as shown in below figure.

Related Links