Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people's questions, and connect with other people.

Have an account? Sign In
Continue with Facebook
Continue with Google
or use

What is the capital of Egypt? ( Cairo )

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people's questions & connect with other people.

Sign Up Here
Continue with Facebook
Continue with Google
or use

What is the capital of Egypt? ( Cairo )

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Volt.Tech

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask question.

Continue with Facebook
Continue with Google
or use

What is the capital of Egypt? ( Cairo )

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

volt.tech Logo volt.tech Logo
Sign InSign Up

volt.tech

volt.tech Navigation

  • Home
  • About Us
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Tags
  • Category
    • Amplifiers
    • Passives & Protection
    • Clocks & Timing
    • Diodes & Rectifiers
    • FPGAs & PLDs
    • Interface ICs & Transceivers
    • LEDs & Optoelectronics
    • Memories
    • MEMS & Sensors
    • Microcontroller
    • Power Management
    • RF & Microwave
    • Security & Smart Card
    • Motor Drivers
    • Wireless Connectivity
  • Groups
  • Add group
  • Badges
  • Help
  • Home
  • About Us
  • Contact Us
Home/Questions/Q 1457
Next
In Process
Rutuja
  • 0
Rutuja
Asked: July 22, 20222022-07-22T15:17:09+05:30 2022-07-22T15:17:09+05:30In: Wireless Connectivity

Way to reduce the SPI buffer size.

  • 0

In our project, the parser reads the G-code from the SD card through the SPI interface, using a usual SD.h library. The problem is that regardless of the size of the SD card buffer, the SPI reads 4092 bytes every time, puts them in the DMA buffer, and reads the next 4092 only when the buffer is free. Because of this, the time for reading g-commands is extremely uneven. Most are read in 20µs, but each 146th is read in over 4500µs. (The average length of g-command is 28 bytes, so 4092/28=146.)
4500µs is approximately equal to the transmission of 4KB at 10MHz. This is a terribly unacceptable time that kills all the advantages of the speed of the microcontroller.

Is there a way to reduce SPI buffer size using arduino IDE? I tried to re-initialize SPI with this construction:

#include “driver/spi_master.h”

#define PIN_NUM_MISO 19

#define PIN_NUM_MOSI 23

#define PIN_NUM_CLK 18 static void spi_init() { spi_bus_config_t buscfg; memset(&buscfg, 0, sizeof(spi_bus_config_t)); buscfg.miso_io_num=PIN_NUM_MISO; buscfg.mosi_io_num=PIN_NUM_MOSI; buscfg.sclk_io_num=PIN_NUM_CLK; buscfg.quadwp_io_num=-1; buscfg.quadhd_io_num=-1; buscfg.max_transfer_sz=64; //default to 4092 if 0 spi_bus_initialize(VSPI_HOST, &buscfg, 1); //DMA channel 1 };

This probably works (message “E (280387) spi: spi_bus_initialize(756): SPI bus already initialized” in console), but in general, the situation does not change. Each 146th g-command is still read in 4500µs. SPI bus is still working through some huge 4KB buffer. And I have totally no idea how to divide it into small chunks of 64-128 bytes.

dma bufferg-codespi
  • 1 1 Answer
  • 0 Followers
  • 0
Answer
Share
  • Facebook

    Related Questions

    • ESP32- CAM What's the Max Capacity of the MicroSD Card?
    • How to Check EMC in Test Mode for the Certification Process?
    • ESP32-U4WDH and VDD_SDIO power
    • ESP32-C3 Firmware Update?
    • ESP32 PCB Antenna Design?

    1 Answer

    • Voted
    • Oldest
    • Recent
    1. pallavi sharma
      2022-07-29T17:07:16+05:30Added an answer on July 29, 2022 at 5:07 pm

      If you use a RTOS-aware structure (like a ringbuffer, queue, whatever) then you don't need to delay: the push into the buffer will block for you while there's no room available. The amount of elements in a ringbuffer is limited by its size, so you can double, triple, however-many-le buffer the thingRead more

      If you use a RTOS-aware structure (like a ringbuffer, queue, whatever) then you don’t need to delay: the push into the buffer will block for you while there’s no room available. The amount of elements in a ringbuffer is limited by its size, so you can double, triple, however-many-le buffer the things by simply increasing the size of the ringbuffer. Also, perhaps good to mention that by ‘ringbuffer’ I specifically mean the esp-idf ringbuffer construct, as that is RTOS-aware. If you use the bytebuffer mode of that, it would be good.

      See less
      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp

    Leave an answer
    Cancel reply

    You must login to add an answer.

    Continue with Facebook
    Continue with Google
    or use

    What is the capital of Egypt? ( Cairo )

    Forgot Password?

    Need An Account, Sign Up Here
    Continue with Facebook
    Continue with Google

    Sidebar

    Ask A Question

    Related Questions

    • ashishgawade

      How to use both UART and SPI FLASH boot?

      • 1 Answer
    • nidhi singh

      RA6T2 Internal Flash?

      • 1 Answer
    • nidhi singh

      RA4M1, SPI with DMA?

      • 1 Answer
    • Techworld

      Why RA4W1 - SPI Interbyte Delay

      • 1 Answer
    • vsharma

      PSoC interfacing with WiFi module over SPI

      • 1 Answer

    Stats

    • Questions 374
    • Answers 360
    • Comments 0
    • Best Answers 8
    • Popular
    • Answers
    • Manoj

      Configuration using .dp vision in Infineon XDPL series IC .

      • 5 Answers
    • Linto

      Renesas RL78/G14 ADC interface code

      • 4 Answers
    • nidhi singh
      nidhi singh added an answer Hi Alex, The FSP and SSP releases are at a… January 25, 2023 at 11:19 am
    • Alex thomas
      Alex thomas added an answer Hello, By default, all GPIO pins start out at reset… January 21, 2023 at 10:31 am
    • nidhi singh
      nidhi singh added an answer Hi, out of my one experience in switch mode power… January 20, 2023 at 11:09 am
    • Alex thomas
      Alex thomas added an answer Hi, You can find the input voltage range in differential… January 18, 2023 at 11:50 am
    • Alex thomas
      Alex thomas added an answer Hi, Do all possible noise sources have to be enabled… January 17, 2023 at 10:26 am

    Users

    test24778098

    test24778098

    • 0 Questions
    • 0 Answers
    vinsfertilityivf

    vinsfertilityivf

    • 0 Questions
    • 0 Answers
    vinshealth

    vinshealth

    • 0 Questions
    • 0 Answers

    Explore

    • Tags
    • Category
      • Amplifiers
      • Passives & Protection
      • Clocks & Timing
      • Diodes & Rectifiers
      • FPGAs & PLDs
      • Interface ICs & Transceivers
      • LEDs & Optoelectronics
      • Memories
      • MEMS & Sensors
      • Microcontroller
      • Power Management
      • RF & Microwave
      • Security & Smart Card
      • Motor Drivers
      • Wireless Connectivity
    • Groups
    • Add group
    • Badges
    • Help

    Footer

    volt.tech

    Volt.Tech

    Find your spark

    About Us

    • About Us
    • Contact Us
    • Groups

    Legal Stuff

    • Privacy Policy
    • Faqs

    Follow

    © 2022 volt.tech. All Rights Reserved
    With Love by volt.tech.

    Go to mobile version

    Insert/edit link

    Enter the destination URL

    Or link to existing content

      No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.