logo elektroda
logo elektroda
X
logo elektroda

Salae 24MHz logic analyzer for 10$ - analysis of an unknown LED display protocol

p.kaczmarek2 5049 7
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • Logic analyzer connected to an LED display showing the time 14:35.
    Today I will present step by step the process of analyzing an unknown I2C protocol using the example of a 7-segment display controller with an HD2015E keyboard found on a board from an old DVB-T2 tuner. The aim of the project will be to collect information needed to control HD2015E from Arduino. Here we will intercept communication on SDA/SCL lines with a logic analyzer bought for 10$, decode it as I2C and then try to guess the meaning of individual bytes.

    Assumptions
    In this case I assume that:
    - the reader has basic knowledge of the I2C protocol or similar protocols, knows that it is based on two lines (clock and data), knows that I2C provides two-way communication (writing and reading from the address), knows that depending on whether we are reading or sending data, the Read/Write bit is set (or not), etc
    - the reader knows more or less how a 7-segment display works, knows that separate segments are lit, that they create digits, that usually one byte (8 bits) maps to one digit and each bit corresponds to a different segment, etc.

    Sale Purchase
    This analyzer is really very cheap, you can get it for only PLN 40 in our country - without waiting for a shipment from China:
    Screenshot of a sale offer for a Saleae 24MHz 8-channel logic analyzer priced at 38 zł.
    Let`s see what the seller says about it:
    Description of a logic analyzer with cables and technical specifications.
    The seller himself admits that this is a "Salae-compatible" analyzer, or colloquially speaking, a clone. I don`t have any complaints about it - for this price... The seller also recommends the link: http://www.saleae.com/downloads, but I already had Pulseview installed.

    Installation of Pulseview and drivers
    My software of choice is PulseView, PulseView is a graphical interface for Sigrok, the application was written in the QT environment and is available for free:
    https://sigrok.org/wiki/PulseView
    You can download it here, both in 32 and 64-bit versions:
    https://sigrok.org/wiki/Downloads
    PulseView allows you to capture live data from the analyzer and play back data previously saved to a file. After starting, we are greeted by a minimalist interface:
    Screenshot of PulseView application with multiple signal channels.
    But it is possible that the analyzer will not be detected yet:
    PulseView error message indicating no active device is set.
    Then you need to install the drivers, I downloaded them from here:
    https://zadig.akeo.ie/
    I selected my analyzer in the list and started the installation:
    Screenshot of Zadig software for USB driver installation
    Zadig driver installer dialog box showing driver installation process.

    Preparation of equipment - HD2015E LED controllerclass="notranslate">
    As part of the Salae demonstration, we will capture I2C communication of a 4-digit, 7-segment LED display controller with additional button support. The display board comes from this topic:
    Old DVB-T2 decoder - STB HD N6 - interior, potential for conversion into a DIY clock
    Even without knowing the pins of the system, it is easy to know what is connected where, because we have signals output to the pads. Both power supply, CLK and DAT are signed:
    Close-up of a circuit board with connectors labeled DAT, CLK, STB, GND, IR_IN, 5V_S, LED.
    In the photo below you can see that CLK and DAT are connected to the HD2015E pins via two resistors.
    HD2015E chip on a circuit board with components and connectors.
    All that remains is to connect the analyzer - but how?
    First of all, you should ensure safe power supply to the tested system, not all converters provide isolation from the mains, so I recommend powering everything from the same laptop/computer on which we perform the analysis. . I will not delve into this topic, because the Salae analyzer is discussed here, but as a good rule of thumb, I simply checked that the power supply on the board gives 5V and I decided to solder a 5V cable to the output of this power supply:
    Close-up of a green PCB with soldered wires and electronic components.
    A circuit board with electronic components and a 7-segment display.
    Now you need to connect the analyzer. We connect the channels we are interested in and be sure to do so too mass , we need to have a common benchmark.
    Circuit board with cables connected for I2C analysis.
    Whole system:
    Circuit board with connected logic analyzer.
    The whole thing will be powered by the USB of one computer, without access to the network.


    Capture and analysis
    We launch Pulseview and click Run, here:
    Screenshot of PulseView program showing an analysis session.
    The capture should start. In case of problems, it is worth trying to restart the program, computer and possibly reinstall the drivers, but I assume that you have already installed them before.
    If necessary, it is also worth increasing the sampling density:
    PulseView interface for logic analysis with sampling settings.
    Initially, I had the sampling set so sparsely that the observed I2C was too fast to read.
    Only the settings as below gave me the result:
    Screenshot of PulseView application with logic state graph.
    The screenshot shows that something happens from time to time. Capture was enabled with the tuner running. What could this be? I suspect it`s keyboard "polling". The display shows the channel number all the time, so it doesn`t need to be refreshed, so it`s probably not the display. However, I don`t see any interrupt pin for pressing a key (some INT, interrupt), so the MCU probably regularly polls the controller about the status of the keys.
    Now it`s time to decode the collected data. We can decode them as I2C:
    Screenshot of Pulseview application with Run button highlighted
    Pulseview decoders are built by the community. We select from the I2C list:
    Screenshot showing the I2C decoder selection panel in PulseView.
    The I2C decoder will appear on the timeline, but you still need to click on it to set the SDA and SCL lines:
    View of PulseView interface with I2C decoder settings.
    I set it according to the connections from the board:
    Screenshot of I2C decoder configuration in PulseView
    From this point the slow I2C decoding process will begin. Patience! With long timelines this may take some time.

    Communication analysis - idle state
    By "idle state" I mean the equipment is turned on but no operations are performed. A channel is simply selected and the user does nothing.
    Nevertheless, from time to time something happens and we capture something:
    Screenshot of Pulseview software displaying a session of I2C data analysis.
    Let`s zoom in and see what`s being transferred:
    Screenshot of PulseView software showing I2C bus signal analysis.
    It seems that one address is given (it is not the address of the device, but of the register, probably the protocol here is not actually I2C, I have already seen versions without the device address) and then data from this address is read.
    I suspect that this is asking the system about the state of the keys, the so-called "polling". This chip does not have an INT/Interrupt pin to indicate that something has happened, so the MCU must regularly query it about the state of the keys to see if anything has changed.
    The state of the keys is read from register 0x27 (or: command 0x27).
    The response 0x07 is the same every time, but will it change when I hold down a key?


    Communication analysis - "next channel" key pressed
    So we repeat the capture, this time holding down the "next channel" key, of course the key on the housing, not on the remote control.
    Now we batch capture two communication sessions together
    PulseView interface with I2C signal analysis.
    Let`s take a closer look at them. First, the package I suspected of handling keys;
    Logic signal analysis on the I2C interface.
    The read value changes. The register is still 0x27, but now we read 0x47 and not 0x07.
    Bitwise it is:
    - 0x07 -> 0000 0111
    - 0x47 -> 0100 0111
    So one key equals one bit, as expected. Probably pressing the second key would light a different bit.

    But that`s not all, here is the second package, let`s take a look at it:
    Screenshot of logic signal analysis in PulseView.
    There`s a lot going on here. Basically I see here:
    - setting the register with address 0x24 to the value 0x71 (repeated)
    - subsequent setting of registers with addresses 0x34, 0x35, 0x36 etc. to different values
    I would assume that 0x24 is the display control register and the registers starting from 0x34 are the registers of displayed digits. The display has 4 digits and we have subsequent entries for 0x34, 0x35, 0x36 and 0x37. Additionally, the first two values written to these registers are 0x00, which agrees with what I see on the display, because I see that the first two digits are off.
    Here`s the same thing, but at a higher magnification:
    Screenshot of Pulseview software showing I2C signal analysis.
    Screenshot from Pulseview with decoded I2C communication.

    Oh, I almost forgot - for convenience, let`s hide the unnecessary lines:
    Screenshot from PulseView software showing I2C signal analysis.
    We just click on them and select "Disable" to hide them.

    Ok, now let`s see what the first channel number is sent to the display, i.e. the first three digits are off and then the character 1.
    I deliberately scrolled to the last channel so that I could access channel 1 with one press of the key.
    Results:
    Screenshot from PulseView showing captured I2C communication.
    Following suit, I also captured subsequent channel changes, always one further, to be able to compare the segment codes sent .
    Here`s the finished comparison:
    I2C communication analysis in PulseView for DVB-T2 decoder
    What do we see here?
    - for 1, the registers are set to 0x00 0x00 0x00 0x06
    - for 2, the registers are set to 0x00 0x00 0x00 0x5B
    - for 3, the registers are set to 0x00 0x00 0x00 0x4F
    - for 4, the registers are set to 0x00 0x00 0x00 0x66
    - for 5, the registers are set to 0x00 0x00 0x00 0x6D
    - for 6, the registers are set to 0x00 0x00 0x00 0x7D
    - for 7, the registers are set to 0x00 0x00 0x00 0x07
    - for 8, the registers are set to 0x00 0x00 0x00 0x7F
    - for 9, the registers are set to 0x00 0x00 0x00 0x6F
    - for 10, the registers are set to 0x00 0x00 0x06 0x3F
    You can see here that in the case of 10, the digit 1 also appears earlier and has the same code 0x06 as in the last place.

    Now we can determine which bits are which segments.
    Let`s start by comparing 0 (0x3F) and 8 (0x7F):
    - 0x3F -> 0011 1111
    - 0x7F -> 0111 1111
    So the middle beam is the seventh bit.
    Diagram of a 7-segment display with labels for each segment.
    Now let`s compare 5 and 6, because 5 is 6 without one segment:
    - 0x6D -> 0110 1101
    - 0x7D -> 0111 1101
    We can see that the difference between them is the bit in position 5:
    Diagram of a 7-segment display with labeled segments.
    In this way, we can also determine the roles of other segments.

    I will also add that I am surprised that the address and the digit value are always sent separately. After all, as a rule, you can only send the address once and then the bytes one by one, and they will be written to subsequent memory cells. Does HD2015 not support it, or maybe the creator of the program simply didn`t use it?

    Communication analysis - standby mode
    Surprisingly, most of what happens on this line is in the standby state, i.e. when the decoder is turned off. This is because a clock then appears. At the time of capture it showed 14:29:
    Screenshot showing I2C protocol analysis in Pulseview.
    But I won`t decode it for now, because it`s setting the numbers the same as I discussed earlier:
    Screenshot from PulseView software showing captured I2C data.
    You could also look here where the colon is sent - perhaps it has a separate register or is attached to one of the digits, after all, the display is 7-segment and the registers are 8-bit, so one free bit is available.

    Summary
    I really liked this logic analyzer. I have been using it for some time now and at the same time I really regret that I didn`t have it 5 or so years ago when I started my adventure with microcontrollers. It would certainly help me more effectively diagnose potential problems with the implementation of I2C or other protocols.
    I am also very satisfied with the computer application, Pulseview - you can even write plugins for it in Python, I once modified one script (WS2812 decoding) to make it compatible with SM15155E, details here .
    As for the analyzed protocol itself, the first thing that catches the eye is the lack of addressing of the system, which means that it is not compatible with I2C and we cannot place several such devices on the bus. It reminds me very much of the protocol TM1637 , wouldn`t it be practically the same?
    Apart from that - no complaints, very simple protocol, maybe in the next part I will try to implement it on Arduino.
    Have you used this or similar logic analyzers? Do you think they are useful? I invite you to discuss.

    Cool? Ranking DIY
    Helpful post? Buy me a coffee.
    Do you have a problem with Arduino? Ask question. Visit our forum Arduino.
    About Author
    p.kaczmarek2
    Moderator Smart Home
    Offline 
    p.kaczmarek2 wrote 11885 posts with rating 9963, helped 569 times. Been with us since 2014 year.
  • ADVERTISEMENT
  • #2 20959379
    Mlody_Zdolny
    Level 30  
    These analyzers are very cheap and very useful, I have purchased a copy, it is waiting in the box, but I have not had the need to use it yet, because an oscilloscope is usually enough for me.
  • ADVERTISEMENT
  • #3 20963709
    Rozrabiakus
    Level 6  
    I didn`t know this program, it looks great.
    So far I have been using Saleae Logic Analyzer 2, which is quite "heavy".
  • #4 20963761
    p.kaczmarek2
    Moderator Smart Home
    @Mlody_Zdolny my Rigol also supposedly has advanced functions, including I2C decoding, but from what I remember, they are paid and have to be unlocked first, which is why such a small Salae analyzer is the perfect solution for me. It is also more handy and mobile.

    @Rozrabiakus I also like it, it has a simple and clear interface
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #5 20963776
    strucel
    Level 35  
    Great article, but this process requires too much intellectual effort for today`s times - ideally, the software would be at such a level that the researcher`s effort would be limited to finding and connecting to the data line, and the rest would be taken care of by AI :)
  • #6 20963814
    Mlody_Zdolny
    Level 30  
    It would be even better if AI found the appropriate protocol for the connected device. I have a display from an HP printer that looks like a regular 2x16 but uses a different interface, I haven`t found any information on what interface it is, I`m waiting, maybe one day I`ll find a similar model and then I`ll listen to it.
  • #7 21079745
    p.kaczmarek2
    Moderator Smart Home
    I forgot to put this in the first post, but maybe someone to study will find it useful - here are the captured packets to open in the analyser. The same thing I discussed in the topic. You don't need to have any hardware (other than a computer) to do this, the software itself is enough:
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #8 21080394
    drunek
    Level 25  
    Will this analyser work properly with a Linux computer? I only see Windows drivers in your link.

Topic summary

The discussion revolves around the analysis of an unknown I2C protocol using a 7-segment display controller (HD2015E) from an old DVB-T2 tuner, facilitated by a low-cost Salae 24MHz logic analyzer. Participants share their experiences with various logic analyzers, including the Saleae Logic Analyzer 2 and Rigol devices, noting the advantages of the Salae analyzer for its portability and ease of use. There are suggestions for improving the analysis process through AI assistance, with one user expressing a desire for AI to identify protocols automatically. Additionally, a follow-up post provides captured packets for analysis, emphasizing that software alone can be used without additional hardware. A question about Linux compatibility for the analyzer is also raised.
Summary generated by the language model.
ADVERTISEMENT