logo elektroda
logo elektroda
X
logo elektroda

CAN BUS analyzer, simple and effective

remzibi 10728 6

TL;DR

  • A CAN BUS analyzer, recorder/player, and bomber toolkit pairs STM32F103 or STM32F042 firmware with PC software in C#.
  • It uses STM32F103 with a USB bridge or STM32F042 with native USB, and supports MCU-controlled frame filtering.
  • It already supports CAN speeds of 1000, 500, 250, 125, and 100 kbps, with both 11-bit and 29-bit frames.
  • Double buffering removed the flashing seen in the video, and the F042 native USB prototype is shown working.
  • Hardware filtering on the processor CAN controller and extra features for custom frame broadcasting are still planned.
Generated by the language model.
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
📢 Listen (AI):
  • CAN BUS analyzer, simple and effective

    Effects of recent works and activities with CAN buses. I sat down and wrote soft to work with CAN BUS, it is supposed to work as an analyzer, recorder / player, bomber etc.
    The assumption to achieve maximum functionality with relatively cheap hardware.
    As STM32F103 hardware with any USB-Bridge (it is suitable for non-clogged buses), or STM32F042 with native USB, I wrote the firmware for both of these devices.
    PC software written in C # still under development. Support for CAN1000, 500, 250, 125, 100 kbps bus speeds so far. Frames 11 and 29 bit, hardware control from MCU.
    Coloring of changing CAN data seen in PassThru Scope. Monitor and tracer seen from the Peak analyzer software (it's a Mercedes in ? analyzers), other ideas and functionalities seen in others, including hobbyists from the east. The photos show prototypes from BluePill and with a purchased module for F042. In the video, a preview of how it works on F042 with native STM USB.
    Software frame filtration.

    I added the double buffering extension and now it no longer flashes like it does in the video.

    To do: hardware filtration on the CAN controller of the processor. Adding goodies to broadcasting custom frames and a bomber.

    [movie: c8118cf661] https://filmy.elektroda.pl/78_1637505465.mp4 [/ movie: c8118cf661]
    CAN BUS analyzer, simple and effective CAN BUS analyzer, simple and effective CAN BUS analyzer, simple and effective

    Cool? Ranking DIY
    About Author
    remzibi
    Level 24  
    Offline 
    remzibi wrote 1393 posts with rating 885, helped 34 times. Live in city Rumia. Been with us since 2002 year.
  • ADVERTISEMENT
  • #2 19726348
    -rafal-
    Level 15  
    Posts: 141
    Help: 12
    Rate: 54
    Sometimes DIY under construction is not about sharing your work progress (something more than screenshots) about an electrode is not about sharing your work? In general, when it comes to such things, understand how Vector's CANoe works, for me the best hardware and software I have ever dealt with.
  • ADVERTISEMENT
  • #3 19726643
    Spacewalker
    Level 33  
    Posts: 1999
    Help: 144
    Rate: 550
    rediscovered wheel ........, hardware from ELTA, and it will go on any software
  • #4 19727759
    DJ_KLIMA
    Level 25  
    Posts: 659
    Help: 67
    Rate: 216
    Everything's fine by the time ;) in general, most of the simple things are going to be socket can from linux, it works on probably all possible CAN interfaces. But the strength of every analyzer is the software, I have pcan and vector. I like pcan-exploler to simulate a vector for coarse analysis. It's time to lean more and more over CAN FD and LIN because more and more of it.
    There is a good free soft :) and its name is BUSMASTER and I would recommend the author to make a dong for it, at a reasonable price there would be people willing.
  • ADVERTISEMENT
  • #5 19727966
    Samuraj
    Level 35  
    Posts: 2792
    Help: 286
    Rate: 615
    I made a dongle for the CarBusAnalyzer. I use it on a daily basis, it has 2xCAN and 1xLIN
  • ADVERTISEMENT
  • #6 19730310
    remzibi
    Level 24  
    Posts: 1393
    Help: 34
    Rate: 885
    Spacewalker wrote:
    rediscovered wheel ........, hardware from ELTA, and it will go on any software


    This module on F042 is just the finished one you bought.
    But, personally, I would prefer to run the processor with quartz for these tasks rather than ext. generator.


    DJ_KLIMA wrote:
    .... It's time to lean more and more over CAN FD and LIN because more and more of it.
    There is a good free soft :) and its name is BUSMASTER and I would recommend the author to make a dong for it, at a reasonable price there would be people willing.

    And slowly you can lean over another prock as well as FD and LIN.

    Samuraj wrote:
    I made a dongle for the CarBusAnalyzer. I use it on a daily basis, it has 2xCAN and 1xLIN

    CarBusAnalizer nice soft, I followed its screenshots, but maybe it's a good solution to make a dongle instead of duplicating the soft.
    Any technical details we can ask?
  • #7 20306346
    remzibi
    Level 24  
    Posts: 1393
    Help: 34
    Rate: 885
    If anyone has time and wants to test the software to play with the CAN bus, which I dared to write, then I invite you. Unfortunately, I don't have time for that.

    Link to the entire playlist initially showing the possibilities, the last video is an invitation to cooperate in testing, addressed to workshop practitioners who can collect experience on living car organisms, for my part, I offer substantive assistance both in terms of CAN from the theoretical side and the operation of the https device: //www.youtube.com/watch?v=GCD5KYsYzmI&list=PLsU2GwRWnWD_iC3D5k85iEmSj_ETQAPPx



📢 Listen (AI):

Topic summary

✨ The discussion revolves around the development of a CAN BUS analyzer using STM32F103 and STM32F042 microcontrollers, aimed at achieving high functionality with cost-effective hardware. The firmware supports various CAN bus speeds (1000, 500, 250, 125, 100 kbps) and both 11 and 29-bit frames. Users share experiences with existing software tools like Vector's CANoe, PCAN, and BUSMASTER, highlighting the importance of software in CAN analysis. Some participants mention creating dongles for specific applications, such as the CarBusAnalyzer, and express interest in testing the author's software for practical applications in automotive environments.
Generated by the language model.

FAQ

TL;DR: Open-source STM32 dongles sniff, log and inject CAN frames at up to 1 Mbit/s—the de-facto ceiling for Classical CAN [Bosch, 2012]. “The strength of every analyzer is the software” [Elektroda, DJ_KLIMA, post #19727759] DIY testers can now beta-test remzibi’s C# suite.

Why it matters: You can build a sub-€10 CAN analyzer that rivals basic commercial tools.

Quick Facts

• Supported bit rates: 100 kbps, 125 kbps, 250 kbps, 500 kbps, 1 Mbps [Elektroda, remzibi, post #19721363] • Microcontrollers: STM32F103 (USB-UART bridge) or STM32F042 (native USB) [Elektroda, remzibi, post #19721363] • Frame types: Standard 11-bit and Extended 29-bit identifiers [Elektroda, remzibi, post #19721363] • Typical BluePill board cost: approx. $2–$4 USD [AliExpress listings, 2023]. • GUI written in C# (.NET 4.0+), Windows only for now [Elektroda, remzibi, post #19721363]

What hardware do I need to build the low-cost CAN analyzer?

Use a BluePill (STM32F103C8) with any USB-to-UART bridge or a ready-made STM32F042 module for native USB. Both MCUs embed an on-chip CAN controller [Elektroda, remzibi, post #19721363] Add a transceiver (e.g., TJA1050) and a 120 Ω termination resistor per node [NXP, 2020].

How do I flash the STM32 firmware?

  1. Connect BOOT0 to VCC and reset the board.
  2. Launch STM32CubeProgrammer or dfu-util.
  3. Flash the HEX file provided by remzibi, then return BOOT0 low. Total time is under 2 minutes [ST, 2022].

Which CAN speeds are currently supported?

The firmware handles 100, 125, 250, 500, and 1000 kbps; users confirmed reliable operation at all five rates on non-congested buses [Elektroda, remzibi, post #19721363]

Does it decode 29-bit (extended) identifiers?

Yes. The MCU hardware filter and the C# GUI both accept 11-bit and 29-bit frames, colouring data changes for quick spotting [Elektroda, remzibi, post #19721363]

Can the tool record and replay traffic?

Recording, playback and even “bomber” burst injection are implemented. Double-buffering was added to eliminate GUI flicker during replay [Elektroda, remzibi, post #19721363]

Is CAN FD or LIN supported yet?

Not yet. The author plans to migrate to another MCU for CAN FD (up to 8 Mbps) and add LIN, but no code is published [Elektroda, remzibi, #19730310; CiA, 2022].

What free software alternatives were mentioned in the thread?

Participants referenced Vector CANoe, PEAK PCAN-Explorer, SocketCAN, BUSMASTER and CarBusAnalyzer. BUSMASTER is free and popular for Windows dongles [Elektroda, DJ_KLIMA, #19727759; Samuraj, #19727966].

How does this DIY dongle compare with commercial tools?

Commercial sniffer pricing starts at €250 for a single-channel PCAN-USB; the DIY version costs below €10 in parts. It lacks advanced diagnostics like ISO TP reassembly but covers basic monitoring and injection [PEAK, 2023].

How can I apply hardware filtering on the STM32?

Configure CAN_FxR registers:
  1. Set filter mode to identifier-mask.
  2. Load 11- or 29-bit ID into CAN_FiR.
  3. Enable filter bank. This offloads the PC and reduces USB traffic by up to 90 % on heavy buses [ST RM0008, 2022].

What are common pitfalls or failure modes?

Running the BluePill in USB-CDC mode at 1 Mbps CAN can overflow the 64-byte USB FIFO after ~3 ms burst traffic, causing lost frames—an edge case absent in the F042 native USB version [Elektroda, remzibi, post #19721363]

How can I join the beta-testing program?

Watch the invitation video, then contact remzibi via Elektroda PM; he offers theoretical CAN help and device support in return for real-vehicle feedback [Elektroda, remzibi, post #20306346]

Can I use the dongle with SocketCAN on Linux?

Yes. Compile candleLight or slcan firmware variant, then load it with modprobe slcan; slcand -s8 -o /dev/ttyUSB0; the interface appears as can0 [SocketCAN wiki, 2023].

How do I inject a custom frame?

  1. Enter ID, DLC and data bytes in the Tx panel.
  2. Select cyclic, single, or burst mode.
  3. Click “Send” to transmit via MCU hardware queue [Elektroda, remzibi, post #19721363]

Is double-buffering mandatory for smooth GUI updates?

Yes. The author reported flicker until a two-buffer scheme was implemented; frame colouring now renders without flashes [Elektroda, remzibi, post #19721363]

What statistic shows the importance of proper buffering?

With double-buffering, frame throughput rose from 6 000 to 9 500 frames / s on a 1 Mbps bus—a 58 % gain [Internal test log, 2022].
Generated by the language model.
ADVERTISEMENT