Giter Site home page Giter Site logo

libcanard polling too slow about kocherga HOT 5 CLOSED

zubax avatar zubax commented on May 24, 2024
libcanard polling too slow

from kocherga.

Comments (5)

chemicstry avatar chemicstry commented on May 24, 2024 3

Just a quick update if anyone encounters this problem. Increasing ChibiOS system tick frequency, as suggested by Pavel, fixed the issue and I'm no longer losing frames.

from kocherga.

pavel-kirienko avatar pavel-kirienko commented on May 24, 2024

Normally, you should fix this at the platform level. You could add an RX FIFO queue between your CAN driver and the library.

Here you can find an STM32F105-based bootloader (CM3 72 MHz, execution from flash) with ChibiOS which works without issues at 1 Mbps: https://github.com/Zubax/zubax_gnss/blob/3ed2388a7dbe0eae226293846b327309d414521e/bootloader/src/board/can.hpp

I am not familiar with your application, but I suppose the culprit might be right here:

/**
 * Hardware FIFO is 3 frames deep; the shortest (worst case) frame duration with acceptance filters allowing only
 * extended frames is:
 *  (1+11+1+1+18+1+2+4+0+15+1+1+1+7) = 64 bits = 64 microseconds @ 1 Mbps
 *
 * Multiply by the depth of the FIFO:
 *  64 * 3 = 192 microseconds
 *
 * Therefore, we must read the driver not less frequently than every 192 microseconds, otherwise we might be
 * losing frames due to RX overrun. Therefore we enforce that the system tick interval is less than that.
 */
static_assert((1000000 / CH_CFG_ST_FREQUENCY) < 180,
            "Minimal delay must be lower in order for the libcanard STM32 driver to work properly");

from kocherga.

chemicstry avatar chemicstry commented on May 24, 2024

Thank you for the link with an example implementation, I think you should add that to the readme.

And yes, that indeed might have been the culprit. I will report if it has fixed the issue if I find time to revert my modifications and try again.

from kocherga.

pavel-kirienko avatar pavel-kirienko commented on May 24, 2024

I think it's well-covered in the README for the driver already: https://github.com/UAVCAN/libcanard/tree/master/drivers/stm32

Writing anything more specific would not be sufficiently generic, so I would rather not do that.

from kocherga.

chemicstry avatar chemicstry commented on May 24, 2024

I mean adding the https://github.com/Zubax/zubax_gnss/ link to this repository as an example implementation of a kocherga bootloader. Sorry for the confusion :)

EDIT: oh my bad, I thought it was based on this bootloader framework, but it's not. Nervermind.

from kocherga.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.