Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CAN bus emulation with FreeRTOS and Qt

CAN bus emulation with FreeRTOS and Qt

Deck from Tallinn DevClub meetup

Andrei Mukamolau

August 25, 2023
Tweet

Other Decks in Programming

Transcript

  1. Who we are • Automotive software development company • Develop

    and design apps • HMI • Android Automotive • Connected cars
  2. Problem • App testing requires real data from the vehicle

    • It can be only obtained from the vehicle • We don’t often have needed vehicle available • Testing becomes expensive
  3. Solution • Cheap CAN bus stand for development • Close

    to real life technologies • Test apps without vehicle
  4. Hardware used in cars • Sensors • ECUs • Instrument

    cluster • Infotainment • CAN bus
  5. CAN bus • Controlled Area Network • 2-way short range

    communication • Used in automotive and industrial apps • Simple at first glance • Fast • Robust
  6. Software used in cars • Embedded soft for sensors •

    RTOS for ECUs • Embedded Linux for infotainment and instrument cluster • Android Automotive for infotainment
  7. Software used in cars • Embedded soft for sensors •

    RTOS for ECUs • Embedded Linux for infotainment and instrument cluster • Android Automotive for infotainment
  8. RTOS • Real Time Operating System • Scheduler runs tasks

    for a fixed amount of time • May not have all the features of standard OSes • Critical for safety-related systems
  9. Software used in cars • Embedded soft for sensors •

    RTOS for ECUs • Embedded Linux for infotainment and instrument cluster • Android Automotive for infotainment
  10. Embedded Linux • Regular Linux kernel, tuned for specific hardware

    • UI can be done in any way • Most popular is Qt
  11. Advantages • Arduino is cheap • Highly configurable • Can

    be extended and ported easily • FreeRTOS is flexible enough • Can be used backwards
  12. Problems • Arduino Uno is not so powerful • FreeRTOS

    eats up memory if you’re not careful • Jitter
  13. What’s Qt • Cross-platform framework • Written in C++ •

    Signals and slots • Double licensing • Its own IDE - Qt Creator
  14. Connect can or vcan • Guide • Connect physical CAN

    HAT • Install the necessary modules • Set up it with commands • Install can-utils • Turn on the interface • Send frames with can-utils The same for vcan but without physical part
  15. Hiccups • C++ errors are obscure • CAN loopback didn’t

    work • Qt libs on Raspberry are not available by default • Qt versions mismatch Win/Mac Qt 6.4.3 Raspberry OS 5.15.5
  16. Demo app workflow • Click on the button on Arduino

    • Build CAN signal and send to Raspberry Pi via CAN wires • Receive CAN frame and process it • Visualize it in Qt application
  17. Q&A