usb-pd-arduino icon indicating copy to clipboard operation
usb-pd-arduino copied to clipboard

How to debug?

Open ismilawd opened this issue 3 months ago • 3 comments

I have made the external PCB and connected it to stm32f103 bluepill as documented but nothing works :( how can I debug the software and the hardware I made using multimeter or oscillascope and check the voltage levels and signals to findout the problem? I already checked the wiring and schematic its ok.

ismilawd avatar Aug 22 '25 15:08 ismilawd

Is your board designed as a protocol analyzer, i.e. for observing the USB PD communication of two separate devices, or as a USB PD sink?

For debugging, you should use your oscilloscope to check if there is communication on CC1, CC2 and on CC_3V3 (after the comparators). On one of CC1 and CC2 you should see a digital signal going between 0V and about 1.6V, and on CC_3V3 you should see the same signal going from 0V to 3.3V. Usually, the communication usually only happens right after connecting the USB PD power source.

If your board is a protocol analyzer, the ProtocolAnalyzer.ino sketch will write output if it detects a device. If it s a power sink, the TriggerBoardAdvanced.ino sketch writes more output than the other sketches.

You can also define the macro USBPD_DEBUG_PIN. Then Pin B3 will indicate certain activities such as ADC conversion complete, EXTI interrupt, processing of received data. If you are using PlatformIO, you can define the macro using build_flags = -D USBPD_DEBUG_PIN=1. If you are using the Arduino IDE, you will need to modify the file PDPhySTM32F1.cpp directly and add #define USBPD_DEBUG_PIN at the top.

These measures should give an indication of what is going on.

manuelbl avatar Aug 22 '25 18:08 manuelbl

I have this kind of signal on pin A5 and no signal at all on pin B5 :( has anyone tried stm32f103 trigger circuit? dso_01_01_00_11_21.bmp

ismilawd avatar Aug 23 '25 16:08 ismilawd

Can you show your schematic? There shouldn't be anything connected to A5.

And your oscilloscope screenshot doesn't even show a full bit. Can you set it to 10µs per division horizontally, and 1V or 0.5V per division vertically?

manuelbl avatar Aug 23 '25 20:08 manuelbl