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/g-code

volt.tech Latest Questions

Rutuja
  • 0
Rutuja
Asked: July 22, 2022In: 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 ...Read more

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.

Read less
dma bufferg-codespi
  1. pallavi sharma
    Added 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
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
  • 1 Answer
Answer

Sidebar

Ask A Question

Stats

  • Questions 395
  • Answers 382
  • Comments 0
  • Best Answers 9
  • 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 Hello, Yes, the software is still available, has not been… April 1, 2023 at 10:34 am
  • ashishgawade
    ashishgawade added an answer Hello, The USB-serial-JTAG port can usually reset/put the chip into… March 30, 2023 at 11:00 am
  • ashishgawade
    ashishgawade added an answer Hi Nidhi, Thanks for reaching out to Volt.Tech Engineering Community.… March 28, 2023 at 10:13 am
  • ashishgawade
    ashishgawade added an answer Hello@vikas, It's always recommended to use a bleeder of 100 ohms. Vout of the part has an offset… March 24, 2023 at 9:55 am
  • vikas Nagpal
    vikas Nagpal added an answer Hello, The SMPS reduces the power loss when VDD is… March 22, 2023 at 10:30 am

Users

test32798456

test32798456

  • 0 Questions
  • 0 Answers
test10977544

test10977544

  • 0 Questions
  • 0 Answers
test17802725

test17802725

  • 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.