5 years, 10 months ago.

Example code for full duplex SPI via DMA?

I'm hoping that someone can post a simple example of using DMAC0 to trigger a full duplex (write/read) SPI transfer of around 12 words or so at 16 bits per word. Getting an interrupt after the 12 words transfer would be great to see as well, but I'll take what I can get.

Question relating to:

GR-PEACH is an Mbed enabled platform which combines the advantages of the Mbed ecosystem and Arduino UNO form factor.

2 Answers

5 years, 10 months ago.

Just Gary

This may be the closest code to what you are requesting - you can also reset the data block / word count.

https://developer.mbed.org/forum/team-886-GR-PEACH_producer_meeting-community/topic/5408/

Thank you try USBHost. Answer the following.and original mbed of the library, the relationship between the library of the GR-PEACH. what each vendor has changed is reflected in the once "mbed-src", it will be reflected in the "mbed" library after the confirmation work by ARM's. And finally the "mbed" "mbed-src" is the same content, but I am allowed to introduce "mbed-src" to be able to offer fast the changes. In addition, "mbed" for can not see the source code, "mbed-src" There is a difference, such as source code can be referenced.

★ study for experimental 3 USB of the Host, and is the case that the communication between Function (Device), use of USBHostSerial is I think simple or.However, it is currently USBHostSerial is not working properly, investigating the cause. # I'm sorry for the "USBHostMSD" does not have the Handbook more information than even here, but I tried to make a sample to read the file information from the USB memory using the USBHostMSD. Please use it if you want. Sample to read 1M byte data from test2.txt the files that are located directly under the USB memory

  1. include "Mbed.H"
  2. include "USBHostMSD.H"

DigitalOut led (LED1);

  1. define READ_SIZE (1024 * 1000) 1MB

static uint8_t Read_buff [ 4096 + 1 ] = { 0 };

void Msd_task ( void const *) {

USBHostMSD msd ( "USB" ); int total_size; int Read_size;

while ( 1 ) {

Try to Connect a MSD device while (! Msd.Connect ()) { Thread :: wait ( 500 ); }

FILE * RFP = fopen ( "/Usb/test2.Txt" , "r" ); total_size = 0 ; printf ( "read start \ n" ); while (total_size <READ_SIZE) { Read_size = fread (Read_buff, sizeof ( uint8_t ), sizeof (Read_buff) - 1 , RFP); total_size + = read_size; Printf ( "% D \ n", Read_size); printf ( "% s \ n", Read_buff); } printf ( "read end \ n" );

Wait disconnect while (Msd.Connect ()) { Thread :: wait ( 500 ); } } }

int main () { Thread MsdTask (Msd_task, NULL , OsPriorityNormal, 1024 * 4 ); while ( 1 ) { ! Led = led; Thread :: wait ( 10000 ); } }

( "Test2.txt" can advance confirmation of the USB memory directly under you need to be prepared to if you change the .READ_SIZE different size.)

regards, PA

5 years, 10 months ago.

The SPI sample using DMA wasn't found. But the DMA driver is available from R_BSP library.

Import libraryR_BSP

RZ/A1H CMSIS-RTOS RTX BSP for GR-PEACH.

DMA API

https://developer.mbed.org/teams/Renesas/code/R_BSP/docs/37222d6ece56/dma__if_8h.html

The DMA driver is used in the following cord.

  • R_BSP/RenesasBSP/drv_src/ssif
  • R_BSP/RenesasBSP/drv_src/scux