Author Topic: STM32F103 not communicating with computer  (Read 4220 times)

0 Members and 1 Guest are viewing this topic.

Offline adorno

  • Contributor
  • Posts: 15
  • Country: es
STM32F103 not communicating with computer
« on: October 24, 2017, 11:06:50 am »
Hi there! First of all, I'm a beginner in electronics and English is not my first language, so please be patient with me. I have a problem with a midi keyboard and I want to fix it. When I plug it in the computer it's not recognized, no matter the cable or the computer I connect it to (Windows, Mac, Linux).

I opened it and found the STM32F103 chip inside. Everything appears to work fine, leds light up and the buttons' programming, so that makes me think that the memory is ok and it's just a problem in the 'data output line', or in both receive/send lines from the USB.

This is the datasheet of the pinout (64 pins, page 24): http://www.st.com/content/ccc/resource/technical/document/datasheet/33/d4/6f/1d/df/0b/4c/6d/CD00161566.pdf/files/CD00161566.pdf/jcr:content/translations/en.CD00161566.pdf

I really don't know where to start. Reading the datasheet I thought that maybe the chip entered a permanent 'rest' state for any reason, and tried to wake it up applying 3.3V to pin14, but nothing happened. Could you guys please guide me through the troubleshooting? I'll appreciate it a lot

Thanks for reading!
 

Offline Zucca

  • Supporter
  • ****
  • Posts: 2480
  • Country: it
  • EE meid in Itali
Re: STM32F103 not communicating with computer
« Reply #1 on: October 24, 2017, 12:05:11 pm »
Do you have a scope? What equipment you have?
Can't know what you don't love. St. Augustine
Can't love what you don't know. Zucca
 

Offline adorno

  • Contributor
  • Posts: 15
  • Country: es
Re: STM32F103 not communicating with computer
« Reply #2 on: October 24, 2017, 12:10:48 pm »
Yes, I have an old Hameg HM312-8 and one of these cheap ebay diy oscilloscope kit. And the normal equipment for a beginner, soldering station, multimeter...


 

Offline Zucca

  • Supporter
  • ****
  • Posts: 2480
  • Country: it
  • EE meid in Itali
Re: STM32F103 not communicating with computer
« Reply #3 on: October 24, 2017, 01:04:06 pm »
Nice, so first start with simple USB sanity checks:

1) 5V there
2) D+ and D- are moving and opposite to each other...

PS: Don't think I am an electronc dragon, I am just trying to help.
Can't know what you don't love. St. Augustine
Can't love what you don't know. Zucca
 

Offline cdev

  • Super Contributor
  • ***
  • Posts: 5082
  • Country: 00
Re: STM32F103 not communicating with computer
« Reply #4 on: October 24, 2017, 01:15:29 pm »
When you plug it in in Linux, and type in "lsusb" or (sudo) dmesg, what does it say? (in the case of dmesg, at the end)
"What the large print giveth, the small print taketh away."
 

Offline adorno

  • Contributor
  • Posts: 15
  • Country: es
Re: STM32F103 not communicating with computer
« Reply #5 on: October 24, 2017, 01:30:06 pm »
lsusb:
Code: [Select]
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

dmesg: it's really long so I uploaded it here
https://cl1p.net/adornoeevblog
 

Offline cdev

  • Super Contributor
  • ***
  • Posts: 5082
  • Country: 00
Re: STM32F103 not communicating with computer
« Reply #6 on: October 24, 2017, 01:47:17 pm »
Could you just paste in the very last part of your dmesg at the end, the part that changes when you plug your keyboard in.. It shouldnt be plugged in then plug it in, what occurs in your logs.. logs are usually in /var/log/*

Try "ls -lat /var/log/*" after plugging it in, the most recently updated logs will be at the very top.

Did you Google your keyboard's model number/name?

Do you know about udev rules, drivers, etc? It can't enumerate as an STM32, it will enumerate as whatever its emulating.



(The USB product and vendor IDs are embedded into the code at compile time.)



« Last Edit: October 24, 2017, 01:59:33 pm by cdev »
"What the large print giveth, the small print taketh away."
 

Offline adorno

  • Contributor
  • Posts: 15
  • Country: es
Re: STM32F103 not communicating with computer
« Reply #7 on: October 24, 2017, 02:07:44 pm »
I get 5V that then get converted to around 3V.

When connected to the computer from the data cables I get:
- Data(-): around 1.5V
- Data(+): around 0.2V

When moving potentiometers no voltage change
 

Offline Zucca

  • Supporter
  • ****
  • Posts: 2480
  • Country: it
  • EE meid in Itali
Re: STM32F103 not communicating with computer
« Reply #8 on: October 24, 2017, 02:17:30 pm »
- Data(-): around 1.5V
- Data(+): around 0.2V

Those are VDC measurements, what about scope them?
Do you see D+(t)=-D-(t)?

Can't know what you don't love. St. Augustine
Can't love what you don't know. Zucca
 

Offline adorno

  • Contributor
  • Posts: 15
  • Country: es
Re: STM32F103 not communicating with computer
« Reply #9 on: October 24, 2017, 02:47:33 pm »
I don't see anything, I plug it in and everything stays the same, it's like the keyboard uses the power from the USB but doesn't communicate at all.

I have googled the keyboard model but couldn't find anything helpful, I have been using it normally since I bought it but one day it stopped working, and I have right on my desk so it didn't fall or get any physical damage.

My only guess is that somehow a current/voltage spike affected something, that or it was designed to fail
 

Offline cdev

  • Super Contributor
  • ***
  • Posts: 5082
  • Country: 00
Re: STM32F103 not communicating with computer
« Reply #10 on: October 24, 2017, 02:49:16 pm »
How do you know its "broken" and not just some driver problem?
"What the large print giveth, the small print taketh away."
 

Offline adorno

  • Contributor
  • Posts: 15
  • Country: es
Re: STM32F103 not communicating with computer
« Reply #11 on: October 24, 2017, 02:54:56 pm »
Not at all, both straight lines at 0.5 microseconds timebase. Data- around 4V mark and Data+ slightly below, around 3.7V
 

Offline adorno

  • Contributor
  • Posts: 15
  • Country: es
Re: STM32F103 not communicating with computer
« Reply #12 on: October 24, 2017, 02:57:47 pm »
I thought if it was a driver problem, connecting it to another computer would solve it. OS X doesn't need any driver from the manufacturer for it to work for example, and I tried it in 5 computers (x2 OS X, x2 Windows 10, x1 Linux) and nothing ever happens, not even a signal that the computer recognized anything attached to it
 

Offline Zucca

  • Supporter
  • ****
  • Posts: 2480
  • Country: it
  • EE meid in Itali
Re: STM32F103 not communicating with computer
« Reply #13 on: October 24, 2017, 03:04:16 pm »
Not at all, both straight lines at 0.5 microseconds timebase. Data- around 4V mark and Data+ slightly below, around 3.7V

So no wonder at the PC side nothing happens...

Can you unplug the PC and feed  the 5V USB to the keyboard with a lab power supply? When you plug the 5V you should see some activities at the D+ and D- lines. If not it´s a HW issue not SW.
Can't know what you don't love. St. Augustine
Can't love what you don't know. Zucca
 

Offline AndyC_772

  • Super Contributor
  • ***
  • Posts: 3548
  • Country: gb
  • Professional design engineer
    • Cawte Engineering | Reliable Electronics
Re: STM32F103 not communicating with computer
« Reply #14 on: October 24, 2017, 03:27:49 pm »
Start by probing a known-good USB device when you plug that in. Make sure you can set up your scope correctly to see activity on the D+ and D- lines, and then when you're sure you can see something that looks correct, try the faulty device.

Offline cdev

  • Super Contributor
  • ***
  • Posts: 5082
  • Country: 00
Re: STM32F103 not communicating with computer
« Reply #15 on: October 24, 2017, 03:33:06 pm »
Often a USB device is not getting enough voltage to work properly when plugged into a computer (this is much more common with laptops) but then using an externally powered USB hub makes the device work.

Not at all, both straight lines at 0.5 microseconds timebase. Data- around 4V mark and Data+ slightly below, around 3.7V

So no wonder at the PC side nothing happens...

Can you unplug the PC and feed  the 5V USB to the keyboard with a lab power supply? When you plug the 5V you should see some activities at the D+ and D- lines. If not it´s a HW issue not SW.

Also, maybe its me but the site you uploaded your dmesg log to says its empty.

You shouldn't upload the entire thing, just what happens when you unplug and replug in the device- it should be at the end.

Does the device enumerate itself- i.e. show up in any of the "device trees" shown on any of the three OS's you have plugged it into?

You can type "lsusb" on linux both before and after plugging it in, whatever changes..  Also, do any new entries show up in the /dev/ directory when you plug it in?

Also, there is a linux program you can install called usbview which can give you some additional information..

 You could also install wireshark to see what is being sent back and forth from its perspective.

« Last Edit: October 24, 2017, 07:51:26 pm by cdev »
"What the large print giveth, the small print taketh away."
 

Offline adorno

  • Contributor
  • Posts: 15
  • Country: es
Re: STM32F103 not communicating with computer
« Reply #16 on: October 24, 2017, 06:33:40 pm »
Ok, here I bring what the oscilloscope is displaying:

Explanation: first I have an USB mouse connected, the normal waves used for data transfer are seen. Then I disconnect the mouse, two flat lines are displayed, then there's one flash of me trying to connect the midi keyboard, and then when the lines distance from each other is the moment I plug the keyboard in. After a few times 'resetting' like in the gif, it stops.

BTW: I adjusted the Y axis of the scope so both probes are right on the X axis.



What do you guys think? It seems like at least it's trying to do something but there's a failure in that process and restarts, as I said earlier, the PC does not react at all.
« Last Edit: October 24, 2017, 06:39:21 pm by adorno »
 

Offline SaabFAN

  • Frequent Contributor
  • **
  • Posts: 687
  • Country: de
Re: STM32F103 not communicating with computer
« Reply #17 on: October 25, 2017, 12:10:56 am »
Did you check the protection-Diodes of the USB Data-Lines?

Offline cdev

  • Super Contributor
  • ***
  • Posts: 5082
  • Country: 00
Re: STM32F103 not communicating with computer
« Reply #18 on: October 25, 2017, 01:42:54 am »
Can you extract any USB product ID or vendor id at all?

This is a useful list of them...

http://www.linux-usb.org/usb.ids
"What the large print giveth, the small print taketh away."
 

Offline Zucca

  • Supporter
  • ****
  • Posts: 2480
  • Country: it
  • EE meid in Itali
Re: STM32F103 not communicating with computer
« Reply #19 on: October 25, 2017, 07:54:35 am »
Did you check the protection-Diodes of the USB Data-Lines?

oh yeah...
Can't know what you don't love. St. Augustine
Can't love what you don't know. Zucca
 

Offline adorno

  • Contributor
  • Posts: 15
  • Country: es
Re: STM32F103 not communicating with computer
« Reply #20 on: October 25, 2017, 11:16:29 am »
This is the board, I don't see anything like a diode around data lines:



Maybe it's this?


 

Offline Rasz

  • Super Contributor
  • ***
  • Posts: 2333
  • Country: 00
    • My random blog.
Re: STM32F103 not communicating with computer
« Reply #21 on: October 25, 2017, 03:21:09 pm »
U3 is an TVS diode array
check if its shorted with multimeter on "beep" setting
also check voltage on 1117 legs when powered on
edit:
also check continuity between end of usb cable and usb socket pins on the pcb
Who logs in to gdm? Not I, said the duck.
My fireplace is on fire, but in all the wrong places.
 

Offline adorno

  • Contributor
  • Posts: 15
  • Country: es
Re: STM32F103 not communicating with computer
« Reply #22 on: October 25, 2017, 04:23:51 pm »
Is there any way to check which diode array is it? Pin 2 is ground, no shorts between any pins.

Voltage in 1117 is 4V, 2.5V and Ground. I'm getting 4V in miniUsb V+ pin.

There's continuity between usb cable and socket pins.
 

Online gamalot

  • Frequent Contributor
  • **
  • Posts: 512
  • Country: au
  • Correct my English
Re: STM32F103 not communicating with computer
« Reply #23 on: October 25, 2017, 04:34:27 pm »
Is there any way to check which diode array is it? Pin 2 is ground, no shorts between any pins.

Voltage in 1117 is 4V, 2.5V and Ground. I'm getting 4V in miniUsb V+ pin.

There's continuity between usb cable and socket pins.

https://www.onsemi.com/pub/Collateral/NUP4201MR6-D.PDF
 

Offline SaabFAN

  • Frequent Contributor
  • **
  • Posts: 687
  • Country: de
Re: STM32F103 not communicating with computer
« Reply #24 on: October 25, 2017, 04:37:55 pm »
Is there any way to check which diode array is it? Pin 2 is ground, no shorts between any pins.

Voltage in 1117 is 4V, 2.5V and Ground. I'm getting 4V in miniUsb V+ pin.

There's continuity between usb cable and socket pins.

4V is too low. As is 2.5V. The markings on the 1117 state it is the 3.3V model.
Your STM32 is getting not enough voltage to work properly.
This is either because your computer cannot deliver the power necessary, the connector is damaged / has corroded contacts, or the cable you are using is bad.
I'd suggest trying a different cable and cleaning the USB-Connector if you haven't done that already.


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf