Skip to main content
SNata.1
Associate
December 1, 2020
Question

Hi Everyone, Weare working on a project where using SPI3 with DMA to communicate with flash. The problem we are facing is when copying a file from our module to PC, (file size is around 130 MB), it takes almost 14 minutes to complete the transfer.

  • December 1, 2020
  • 7 replies
  • 1920 views

Is there anyway we can decrease this time. We are using void DMA2_Channel2_IRQHandler(void) and void DMA2_Channel1_IRQHandler(void). Both RX and Tx callbacks are not firing and really not able to debug this issue. Looking forward to a solution. Thanks everyone.

This topic has been closed for replies.

7 replies

Uwe Bonnes
Chief
December 1, 2020

How is the transfer from board to PC done (e.g. Serial, USB FS, USB HS)? What device?

SNata.1
SNata.1Author
Associate
December 1, 2020

HI, Thanks for the quick reply. It is USB HS. STM32L151VEYx MCU. Device is a datalogger board, designed and fabricated by us.

Tesla DeLorean
Guru
December 1, 2020

Depends where the bottleneck is. USB MSC probably looking at 4-5 minutes​

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Tesla DeLorean
Guru
December 1, 2020

I'd imagine it could be done faster.

Post a bit light​ on any usable detail to provide a diagnosis.

Why can't you and your team better understand and debug the failure?

I​nterrupts and callbacks not occurring suggests an error is being flagged or the transfer is not actually happening. Or you're using C++. Do an inspection of the peripheral registers. Do a disassembly of the code, check the vector table and associations with interrupts used and callbacks. That your routines linked in.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
SNata.1
SNata.1Author
Associate
December 1, 2020

Hi Clive1,

Thanks. Actually transmission happens without an issue. We are able to copy files from device to PC and vice versa. The problem is the timing. How to improve or reduce cycle time. We are reading 512 bytes per read, so for a 4096 block, we need 8 such reads. Again, this current setup works fine.

Tesla DeLorean
Guru
December 1, 2020

A USB MSC or something else?

C​heck MSC_PACKET_SIZE definition, or something similar, don't recall, not at a computer.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
SNata.1
SNata.1Author
Associate
December 2, 2020

it is USB MSC only. We declared our own variable for packet size as 512 bytes. HAL_SPI_Receive_DMA(&heval_Spi3, buf, USB_BLK_SIZ); declared USB_BLK_SIZ as 0x200

Tesla DeLorean
Guru
December 2, 2020

/* MSC Class Config */

#define MSC_MEDIA_PACKET                     8192

Allows for more efficient multi-block read requests from host OS

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
SNata.1
SNata.1Author
Associate
December 2, 2020

Thanks. We will try and update on the results.

SNata.1
SNata.1Author
Associate
December 2, 2020

If we change any value above from 512, the USB device is not recognized. PC cannot recognize our module.