Replies: 2 comments
-
Beta Was this translation helpful? Give feedback.
0 replies
-
Thank you very much for the detailed answer. I had missed you read the data in little-endian such that your 0b10110100 pattern indeed matches the preamble. I also got my own implementation to work. The issue was that "USB PD protocol is very timing sensitive" :) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Thank you for this repository of code for communicating with USB power supplies. I working on my own implementation, but so far failed to make the power supply recognize my GoodCRC and Request messages.
I'm looking at your code as reference, and ran into a bug or misunderstanding regarding the PD packet preamble.
In the encoding of the preamble,
usb-pd-arduino/src/PDMessageEncoder.cpp
Lines 90 to 92 in a9765e7
there are 16 chunks of "1010" (in BMC). However, the USB PD specification section 5.6.1.1 states that "The Preamble Shall consist of a 64-bit sequence of alternating 0s and 1s. The Preamble Shall start with a "0" and
Shall end with a "1"." This pattern is also what I see when receiving Source_Capabilities messages in my own implementation.
As such, I had expected
Your code obviously works, and mine doesn't. What did I miss?
Beta Was this translation helpful? Give feedback.
All reactions