Become a leader in the IoT community!

New DevHeads get a 320-point leaderboard boost when joining the DevHeads IoT Integration Community. In addition to learning and advising, active community leaders are rewarded with community recognition and free tech stuff. Start your Legendary Collaboration now!

Step 1 of 5

CREATE YOUR PROFILE *Required

Change Email
OR
Step 2 of 5

WHAT BRINGS YOU TO DEVHEADS? *Choose 1 or more

Collaboration & Work 🤝
Learn & Grow 📚
Contribute Experience & Expertise 🔧
Step 3 of 5

WHAT'S YOUR INTEREST OR EXPERTISE? *Choose 1 or more

Hardware & Design 💡
Embedded Software 💻
Edge Networking
Step 4 of 5

Personalize your profile

Step 5 of 5

Read & agree to our COMMUNITY RULES

  1. We want this server to be a welcoming space! Treat everyone with respect. Absolutely no harassment, witch hunting, sexism, racism, or hate speech will be tolerated.
  2. If you see something against the rules or something that makes you feel unsafe, let staff know by messaging @admin in the "support-tickets" tab in the Live DevChat menu.
  3. No age-restricted, obscene or NSFW content. This includes text, images, or links featuring nudity, sex, hard violence, or other graphically disturbing content.
  4. No spam. This includes DMing fellow members.
  5. You must be over the age of 18 years old to participate in our community.
  6. Our community uses Answer Overflow to index content on the web. By posting in this channel your messages will be indexed on the worldwide web to help others find answers.
  7. You agree to our Terms of Service (https://www.devheads.io/terms-of-service/) and Privacy Policy (https://www.devheads.io/privacy-policy)
By clicking "Finish", you have read and agreed to the our Terms of Service and Privacy Policy.

Does Linux Have a Maximum Buffer Size for Serial on Embedded Systems?

hey @melta101 are you aware if Linux has had a set maximum buffer size for serial?

  1. 32bitSaviour#0000

    I am working on a 32-bit embedded Linux, kernel is 2.6 running on a 64mb device.

  2. 32bitSaviour#0000

    Trying to stream in some 2MB of data into the device but get stuck after reading in a couple of KBs.

  3. 32bitSaviour#0000

    `dmesg` gives me
    `circ_buf_get err now with c:`

  4. melta101#0000

    for which device is it?

  5. melta101#0000

    i have seen TI’s related driver have a default of 2kB as buffer normally

  6. melta101#0000

    honestly if possible, try using HW/SW control to stream data

  7. 32bitSaviour#0000

    a proprietary device datasheet is very vague on speccific
    0image.png

  8. 32bitSaviour#0000

    been thinking it is an algorithmic issue.

  9. melta101#0000

    most probably,
    as 2kB is more than enough for buffer

  10. melta101#0000

    i would either break the stream into small payloads or use some form of control flow

  11. 32bitSaviour#0000

    @melta101 it was a HW constraint issue. The device is configured to accept only 16K of data at a go.
    I simply just read 16K then send an ack byte to inform the sender to give me more data.
    The implementation is a bit slow since I need to read the data over 128 iterations.

  12. melta101#0000

    ahh,
    That’s nice
    how were you able to find it to be HW contraints

  13. 32bitSaviour#0000

    An almost strongly worded email to the manufacturer of the device, asking for docs, but I was only offered the buffer size constraint.

  14. 32bitSaviour#0000

    I am thinking how easy it would be to use `setvbuf` with the serial file descriptor for automated streaming.
    Maybe I will run away from those loops.

  15. melta101#0000

    what’s the prob with the fragemented approach, like the one above, other than some overhead, it should be fine

  16. 32bitSaviour#0000

    the solution is perfectly fine but if I could be faster. Be greater, since theoretically with 115200 baud and some 100ms of copying to another buffer and sending back ack, the stream should take about 3 minutes.

  17. ZacckOsiemo#0000

    Stupid question DMA?

  18. 32bitSaviour#0000

    It’s a linux box and the serial is usb. DMA would be overkill. Killing a cockroach with an atomic bomb and not even achieving better results, not dying faster.

  19. ZacckOsiemo#0000

    Ah I see, same round trips too if the hardware limit exists

  20. 32bitSaviour#0000

    Exactly. I am thinking I can shave off sometime with a bigger baudrate… I’ll see. And cut out buffer copying with `setvbuf`… not sure how that’ll work, yet.

  21. melta101#0000

    which subset of USB?
    serial, or acm?

  22. melta101#0000

    or something else?

  23. 32bitSaviour#0000

    ACM, I think the driver is custom or a modified version of some bcm usb cdc

  24. 32bitSaviour#0000

    At least that what I have gathered from a bit of digging. But I realize it has become irrelevant, what I need to solve is more high level at this point.

CONTRIBUTE TO THIS THREAD

Browse other questions tagged 

Leaderboard

RANKED BY XP

All time
  • 1.
    Avatar
    @Nayel115
    1620 XP
  • 2.
    Avatar
    @UcGee
    650 XP
  • 3.
    Avatar
    @melta101
    600 XP
  • 4.
    Avatar
    @lifegochi
    250 XP
  • 5.
    Avatar
    @Youuce
    180 XP
  • 6.
    Avatar
    @hemalchevli
    170 XP