Skip to main content
Lukasz Przenioslo
Associate III
November 3, 2018
Solved

STUSB1602 SPI interface

  • November 3, 2018
  • 47 replies
  • 6211 views

Hello there,

I am currently analyzing the STUSB1602 chip and the P-NUCLEO-USB002 eval kit. I have come across a topic I am not fully certain about. Its the SPI interface for the BMC communication. I cannot understand either it is necessary in all applications, or only if I want to exchange some specific data between devices over CC line? For example, if I intend to create a sink only device, so I have to connect the SPI lines and provide any data from the MCU? I would appreciate all help.

This topic has been closed for replies.
Best answer by Benoit FORET

not yet. This is a reference design: Altium design files are available on line for fast duplication: STREF-SCS001V1.

But I can ship one to you: just share with me your address via private messaging (accessible via the message button when pointing my name with the mouse).

Benoit

47 replies

ST Employee
November 6, 2018

​Hello Lukasz,

basically, STUSB1602 integrates:

  • a stand-alone USB type-C state machine,
  • and the PHY layer (up to BMC coding) of the USB PD protocol stack. The upper layers of the stack must be implemented into an MCU, and the interconnection between the Software (High level layers) and the Hardware (low level layers) is achieved through this dedicated SPI interface (very convenient in case of incoming message).

Therefore,

  • for simple connection and negotiation at 5V, the USB-C FSM can manage it autonomously,
  • but for true USB PD negotiation (above 15W), or for sending Vendor Define Messages (VDM) from one side to the other side, the PD protocol is required and it is run from the MCU through the STUSB1602 companion chip.

Hope it helps,

Rgds,

Benoit

Lukasz Przenioslo
Associate III
November 6, 2018

Hi, thank you for answer.

Let me specify more the issue of my concern. Lets say the main MCU is off, since battery is fully discharged. My device is "device only", so I will never charged, just be charged. So the MCU is off and an USB C charger is connected now. How will the STUSB1602 react since it cannot communicate using SPI? If the charger is capable of providing 20V, 2A, will it utilize it?

Does the MCU really need to talk with the STUSB1602 at any point if it only needs to obtain current in all voltage range? Also, I am not talking configuration wise using I2C- thats OK. Only about SPI. I would appreciate further explanation.

ST Employee
November 6, 2018

Hello,

With MCU + STUSB1602 as a companion chip, the system can only negotiate 5V input power in "dead battery" state​ (ie.the MCU and the remaining application has no power, only STUSB1602 can wake up). Battery needs to be charged at 5V until there is enough energy to Power ON the MCU, run the PD stack in order to re-negotiate for higher power if available from the source.

If you need a fully standalone USB PD controller able to negotiate higher power from dead battery state, let me advise STUSB4500 (this is a SINK only device, not dual role). This product does not need external MCU support to perform USB PD power negotiation.

Rgds,

Benoit

Lukasz Przenioslo
Associate III
November 6, 2018

I see, thank you for information. I will check that chip out.

So, if for example the the source is not able to provide 5V, but only 20V, the device would never wake up?

ST Employee
November 6, 2018

​As per USB-C/PD standard, devices (SOURCE and SINK) must always connect themselves at 5V (type-C mode) before exchanging power profiles (PDO) via USB PD protocol and agree to transition to higher voltage. If a device (either a SINK or a SOURCE) does not respect this rule, STUSB controllers will not close their respective power path in order to self protect their application from a non-compliance of the attached device.

Short demo about STUSB4500 negotiation capabilities (dead battery; no MCU) available here:   https://youtu.be/GXREJP8f5x4

bye

Lukasz Przenioslo
Associate III
November 6, 2018
Hello,
Understood, thank you. I need that stick from the video then. The ST website doesnt say either it is available from the distributors. Do you know how can one sample it?
Benoit FORETBest answer
ST Employee
November 6, 2018

not yet. This is a reference design: Altium design files are available on line for fast duplication: STREF-SCS001V1.

But I can ship one to you: just share with me your address via private messaging (accessible via the message button when pointing my name with the mouse).

Benoit

Lukasz Przenioslo
Associate III
November 6, 2018

Hello,

Yes, just notice them. Will be really helpful in the end design. PM'ed you, thank you for help!

ST Employee
November 12, 2018

​Hello Lukasz,

As far as I know about this laptop, it is powered by a 240W AC adapter (can you confirm?). This is far above the USB PD spec (100W max). So not sure it is able to be powered directly via type-C port. Same for the Dockin station. I assume it can run Thunderbolt or DP over USB-C, but power capabilities have to be checked. Some high-end laptop or smartphone may support 9V as a SOURCE, but most device support 5V.

In order to test a USB-C port for its power capabilities, you can use the P-NUCLEO-USB002 and associated Command Line Interface. It is able to report the power profiles (SOURCE and SINK) of the device it is attached to. This way, you can check if it matches the STREF-SCS001V1 profiles (5V/1.5A; 15V/1.5A; 20V/1A).

More expensive, the TotalPhase sniffer is a very useful tool for USB-C developpers:

https://www.totalphase.com/products/usb-power-delivery-analyzer/

Rgds,

Benoit

Lukasz Przenioslo
Associate III
November 12, 2018

Hello Benoit, thank you for answer.

The Dell 7730 machine is a very complicated one. In terms of USB C it doesnt work 100% yet, I am in constant support with Dell. But no matter that, the docking station is able to charge the laptop. The PC consists of 2 USB C ports next to each other. The dedicated docking station for it is the TB18, which consist of this mutant 2x USB C plug:

0690X000006CMA6QAO.jpg

I dont know this for sure (as it is not written anywhere, and talking to Dell support about such things is pointless, would probably need to talk to the core developer...), but it is designed like this probably because the 240 W you have mentioned is way above the spec of a single USB C cable. But- one can still charge the laptop using a signle USB C cabled docking station, like the one made for small dell latitudes. It simply takes longer to charge then. Another interesting thing is that when the STUSB4500 was connected to the docking station, it reported 5V only at one of the available USB C plugs. No voltage present on the other...

As for your notes- 9 V is not bad, but I really hoped for 15/20V available on the laptops end.

I do have the P-NUCLEO-USB002 kit but the default program there did not report anything on the COM port available through ST-LINK. Do you have any resource on that maybe?

Sorry for condensing so many questions here, but this USB C is still a mystery for me and I really need to understand what going on. The application I plan to use it for is not very "regular" so I need to know all of the ins and outs. Also, the not-standard USB C capabilities of the Dell 7730 doesn't help here. I have the possibility to test it on Dell Latitude 5580 as well though.

Looking forward to your thoughts.

ST Employee
November 12, 2018

​There is a P-NUCLEO-STUSB002 Quick start manual  on st.com: UM2205. Take care not to forget the TX/RX wires between the NUCLEO board (white) and the Expansion board (blue): cf §1.5.2.2.

I can also recommend the STEVAL-ISC004V1, which is a certified ready to use SOURCE supporting (5V/9V/12V/15V/20V). You can use it as a reference. There is also a GUI including a DASHBOARD running on NUCLEO, which reports to you the power profiles of the SINK you attach to this board.

See bellow MacBook power profile reported by the GUI. Similar test could help to understand your laptop requirements

0690X000006CMCvQAO.png

Lukasz Przenioslo
Associate III
November 12, 2018

Hello Benoit, thank you for answer. Ok so I took the P-NUCLEO-USB002 and connected the wires and jumpers like advised in the manual. Bellow is a picture:

0690X000006CMDUQA4.jpg

I connected to the serial console, we are good at this point:

P-NUCLEO-USB00x Demo v1.0.4
Console v0.4
Type help for a list of commands.
STMicroelectronics
Copyright (c) 2017 - All Rights Reserved.
>

The manual proposes to connect both USB C connectors on the PCB together. I understand that they should negotiate which one will be the sink, and which one will be the source. But when I do that:

*** [1] attached on CC1 (Source)
 
*** [1] detached
 
*** [0] attached on CC2 (Source)
 
*** [0] detached
 
*** [1] attached on CC1 (Source)
 
*** [1] detached
 
*** [0] attached on CC2 (Source)
 
*** [0] detached
 
*** [1] attached on CC1 (Source)
 
*** [1] detached
 
*** [0] attached on CC2 (Source)
 
*** [0] detached
 
*** [1] attached on CC1 (Source)
 
*** [1] detached
 
*** [0] attached on CC2 (Source)
 
*** [0] detached
 
*** [1] attached on CC1 (Source)
 
*** [1] detached
 
*** [0] attached on CC2 (Source)
 
*** [0] detached
 
*** [1] attached on CC1 (Source)
 
*** [1] detached

And this goes forever. For a test, I now connect the STREF-SCS001V1 to the USB C 0 port of the P-NUCLEO-USB002:

*** [0] attached on CC2 (Source)
 
*** [0] detached
 
*** [0] attached on CC2 (Source)
 
*** [0] detached
 
*** [0] attached on CC2 (Source)
 
*** [0] detached
 
*** [0] attached on CC2 (Source)
 
*** [0] detached
 
*** [0] attached on CC2 (Source)
 
*** [0] detached
 
*** [0] attached on CC2 (Source)
 
*** [0] detached
 
*** [0] attached on CC2 (Source)
 
*** [0] detached
 
*** [0] attached on CC2 (Source)
 
*** [0] detached
 
*** [0] attached on CC2 (Source)
 
*** [0] detached
 
*** [0] attached on CC2 (Source)
 
*** [0] detached
 
*** [0] attached on CC2 (Source)
 
*** [0] detached
 
*** [0] attached on CC2 (Source)
 
*** [0] detached

Similar result... So Now I connect the USB C 0 of the P-NUCLEO-USB002 to my laptops hosts USB 2.0 socket (using USB C to USB A 2.0 male plug):

*** [0] attached on CC1 (Sink)

Seems to be working. Now I connect a mobile phone to the other connector of the P-NUCLEO-USB002 using USB C -> USB C cable:

*** [1] attached on CC2 (Source)
 
*** [1] detached
 
*** [1] attached on CC2 (Source)
 
*** [1] detached
 
*** [1] attached on CC2 (Sink)
 
*** [1] selected cap #1

Some weird activity but works eventually, the phone is charged.

0690X000006CMENQA4.jpg

The question is why doesn't the demo application from the manual work? I would appreciate your further help.

Also sorry for not noticing the uart setup for the P-NUCLEO-USB002 earlier.

ST Employee
November 12, 2018

​Lukasz,

I'm not an expert of this board, but please note it is not very convenient for emulating Power Delivery SOURCE, as you need to provide appropriate voltage to make it work above 5V.  It is good as a SINK for asking SOURCE profiles.

For above first 2 cases, it looks to go in error recovery, certainly because the 5V is not available on VBUS_SRC.  Please check to connect jumpers JP400 and JP401 (which allow to power VBUS_SOURCE from the 5V from the NUCLEO mini-B. It should solves your issue. Then, you can test with your dockin and your laptop, and enter command p [port number 0 or 1]. see >help command

Benoit

Lukasz Przenioslo
Associate III
November 12, 2018

Benoit, thank you for answer. I did not close the JP400 and JP401 because they were open in the manual. Also the phone was changed, so I thought that was not the case. But yes, after closing them both I was able to successfully connect the USBC 0 and USBC 1 connectors of P-NUCLEO-USB002 board together:

P-NUCLEO-USB00x Demo v1.0.4
Console v0.4
Type help for a list of commands.
STMicroelectronics
Copyright (c) 2017 - All Rights Reserved.
>
*** [0] attached on CC2 (Sink)
 
*** [1] attached on CC2 (Source)
 
*** [1] selected cap #1
 
*** [0] selected cap #1

So now I wanted to test the P-NUCLEO-USB002 -> STREF-SCS001V1 connection. The peripheral was correctly set to source. The thing is I keep getting the "selected cap X" message (I am not sure what does it mean exactly also):

*** [0] attached on CC2 (Source)
 
*** [0] selected cap #4
 
*** [0] selected cap #4
 
*** [0] selected cap #4
 
*** [0] selected cap #4
 
And goes on about every 3 seconds...

Do you know maybe what could be the case? Thank you very much for your help so far.

ST Employee
November 12, 2018

​

By default, the P-NUCLEO-USB002 virtually offers the bellow 4 profiles as a SOURCE,

And a single 5V profile as a SINK

That’s why when you connect both port of the P-NUCLEO together, they both connect at 5 (cap #1 => 5V/1.5A )

On the other side, STREF-SCS001V1 has the following SINK profiles:

  • PDO1: 5V / 1.5A
  • PDO2: 15V / 1.5A
  • PDO3: 20V / 1.0A

So when you connect both card together, the SINK will request PDO4 from the SOURCE (20V – 2A) as it matches what it needs (PDO3 from STREF-SCS001V1). This is what the P-NUCLEO tells you: [0] selected cap #4 (Cap #4 being the PDO4 with 20V – 2.00A.)

The issue is: as the P-NUCLEO, by default, can’t supply the expected 20V, then both devices will Hard reset (open the VBUS switches), terminate the type-C and PD transaction, connect again, identify, negotiate again etc… etc.. in endless loop.

This is why you see the message every few seconds. The boards behave properly, as the High voltage from the SOURCE is missing. 

If STREF-SCS001V1 is not able to negotiate more than 5V with your laptop or dockin,

It means those 2 devices can’t offer the 15V;1.5A or 20V / 1.0A requested by STUSB45.

You can use the P-NUCLEO-USB002 as a SINK to understand the profiles from the 2 devices. It should confirm that default profiles from STREF-SCS001V1 is not compatible with your devices.

In this case, there are several ways to reconfigure the SINK profiles in order to align with the SOURCE (either by software with an external MCU or by changing the non Volatile Memory default). I can explain later.

benoit

ST Employee
November 12, 2018

this picture missing

0690X000006CMLxQAO.png​

Lukasz Przenioslo
Associate III
November 12, 2018

Thank you for answer Benoit,

this makes sense. As I dont have all my tools with me at home, I could only hook up 5V to the CN12 connector. When done like this, I see that the STREF-SCS001V1 stopped reseting, but the P-NUCLEO-USB002 did not recognize the STREF-SCS001V1 at all. I believe this is die to the fact that I connected 5V, not higher. On the other hand, when I connected P-NUCLEO-USB002 together, I could freely change the profiles for the sink and the source did no argue at all.

I also don't have my laptop and dock with me.

Could you only confirm either the external voltage provided (as 5V) is too low and this could be the case of the P-NUCLEO-USB002 not seeing the STREF-SCS001V1 at all?

Apart from this, I will test some more tomorrow at work, where I have more voltages to work with and the laptop + docking station. Thank you very much for help.