Skip to content

Latest commit

 

History

History

Sending_Data_as_Host

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

MCHP

Sending Data as Host

This example shows how to configure the device in SPI Host mode, control a client and send dummy data (value 0).

Related Documentation

More details and code examples on the AVR128DA48 can be found at the following links:

Software Used

Hardware Used

Setup

The AVR128DA48 Curiosity Nano Development Board is used as a test platform.


The following configurations must be made for this project:

  • System clock is configured at 3.33 MHz
  • SPI
    • SPI clock configured at 416.66 kHz
    • SPI in Host mode
    • Data mode 0
    • LSB transmitted first
    • Clock Double enabled
    • SCK - PA6, SS - PA7, MOSI - PA4, MISO - PA5
Pin Configuration
PA4 (MOSI) Digital output
PA5 (MISO) Digital input
PA6 (SCK) Digital output
PA7 (SS) Digital output

Operation

  1. Connect the board to the PC.

  2. Open the Sending_Data_as_Host.X project in MPLAB® X IDE.

  3. Set the Sending_Data_as_Host.X project as the main project. Right click the project in the Projects tab and click Set as Main Project.


  1. Clean and build the Sending_Data_as_Host.X project. Right click the Sending_Data_as_Host.X project and select Clean and Build.


  1. Select AVR128DA48 Curiosity Nano in the Connected Hardware Tool section of the project settings:
  • Right click the project and click Properties;
  • Click the arrow under the Connected Hardware Tool;
  • Select AVR128DA48 Curiosity Nano (click the SN), click Apply and then click OK:


  1. Program the project to the board. Right click the project and then click Make and Program Device.


Demo

The image below shows the MOSI (PA4), SCK (PA6) and SS (PA7) signals captured by a logic analyzer. Every time the client is selected (SS line low), the device outputs the SCK signal and sends 0x00 through MOSI line.

Summary

This example showed how to configure the device in SPI Host mode, control a client and send dummy data (value 0x00).