cancel
Showing results for 
Search instead for 
Did you mean: 

Starting STM32 USB project

shingadaddy
Senior
Posted on September 21, 2016 at 18:14

I'm about to start a USB project. New to me with STM.

I am using an STM32L476RG on a Nucleo board. (Yes we're cheap). I see LOTS of opportunity for myself. Lots of GOOD and LOTS of UNKNOWN. The LOTS of UNKNOWN can easily go BAD based on my experience. I'd like to avoid that if possible.

I'm willing to do a lot of work. Probably what it will take anyway. I like learning. But I'm just listing some observations and possible pathway steps I might take here and would appreciate any nudges, encouragement, discouragment, suggestions that might make the UNKNOWN not go BAD...   Try not to point and giggle though..  :\

1. The Nucleo doesn't have a USB connector on it DIRECTLY to the STM32L476RG. (PA11-44 and 12-45). It DOES have one to the STLINK STM32F103 on the debug board. THAT USB hole culminates in a serial connection to the 476 for debug ( and a sneaky VCP to the F103 ) via a USART on the 476. Right?

2. Nothing stopping me adding a good old fashioned USB B type connector to the Nucleo header pins for the  DP, DM, USB power sense and ground other than maybe a little worry about those finicky transmission line wiggles that the sub ideal connection means might induce into the signals. Right? (Okay I'll keep em short. No 1 foot wire wrap wire jumpers.)

3. Should be able to get this

C:\stm32cubel4\STM32Cube_FW_L4_V1.2.0 Projects\STM32L476G_EVAL\

 

Applications\USB_Device\CDC_Standalone\Src

example application running AFTER I go and get the later CUBE version which is now 1.5 Right?

4. I don't necessarily want a VCP driver to launch on the PC when I plug my device in. But THIS CDC example code probably will do that. Right?

5. The USB - HID device example will show up as HID device when plugged in.

Right? (remember - no giggling)

6. Devices that require a custom or specific driver to be launched when plugged in, are trigered to do so by specific information from the device when it is plugged in, during enumeration / discovery. (Descriptors)

Right?

7. The first thing a USB device gets hit with when it is plugged into a HOST USB port is a RESET signal from the HOST. This causes some esablished standard communication protocols to kick off from a known starting point so everybody gets on the right page to start with. 

Right?

8. Just my AT-A-GLANCE -

I kind of half suspect that ALL this USB stuff will be a nearly an exact outer operational framework as I have seen in getting and embedded Ethernet solution running. Not the DATA / ICD formats or anything but just the concept. Like for The embedded Ethernet code – there is a BUNCH of lines of code that gets ran ONCE to set the thing up. Then you set around waiting for a CONNECTION interrupt and that runs a BUNCH of OTHER lines. THEN you just sit around and wait for an I GOT SOMETHING! interrupt and grab data or you load up a buffer and punch the driver in the nose to transmit it. Lastly there a DISCONNECT to handle also. Another BUNCH of lines of code.

Close ???

I'm looking forward to diving into this. The rest of my STM experience has went really well.

Thanks folks.

7 REPLIES 7
shingadaddy
Senior
Posted on October 26, 2016 at 22:44

Well I'm back at it and ready to start!

Surprised to find NO REPLIES ?

No Pro's or Enthusiasts chiming in seems a little odd.

Does this forum still operate?

Posted on October 27, 2016 at 04:29

Does this forum still operate?

You might observe that I don't come here and ask ponderous questions and seek direction, I'm a prime mover, and I just get on with it. I think you'd do well just going off and studying the topics that interest you and experiment with them.

Forums can be like empty rooms, often you'll just be talking to yourself, as others are contemplating their own problems, and not yours.

Lot of things in your post I'm just not interested in wading into, sorry..

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
shingadaddy
Senior
Posted on October 27, 2016 at 16:24

Thanks clive1. No problem

I came here and dumped that out and immediately HAD to take vacation. HAD to or loose it. And was told to TAKE it. So yeah it was a case of me writing it down somewhere so I wouldn't forget it. As a matter of fact I had all of that and more written down somewhere ELSE so I'd be able to pick up where I left it (somewhat) and thought I'd see if anyone had a good grip on any of it and might comment. I also  thought it might help others who are trying to get started down this path so here goes:

1. Yes

2. Should be okay. Just have to try. We'll know later this week. Maybe today.

3. Yes. The NUCLEO examples don't have a USB example in CubeL4 1.2 but the EVAL examples do. Maybe CubeL4 1.5 NUCLEO does. But CubeL4 1`.2 compiled CDC with TrueStudio without issue. Should add some confidence to the TODAY prospect above in #2. Barring interruptions.

4. All indications are YES

5. All indications are YES

6. Absolutely.

7. 99.9% yes. Not a HARD RESET but causes a soft process to run which reinitializes the device and cause it to spill its DEVICE descriptor. The HOST can then query the DEVICE about CONFIGURATION, which is covered in about 10 other descriptors.

(usbd_cdc.c)

8. Close - yeah - T

urns out that for USB, it’s much, MUCH more than that at the CONNECTION time. The similarities stop beyond the near equal function of DHCP for ETHERNET and ENUMERATION for USB. Along with getting a basic CONNECTION established with PORT and maybe HUB numbers assigned to the USB device, the HOST queries the USB device for any and ALL capabilities that it offers.

I still need to look into how it notifies when it GETS something from the host and how to SEND stuff to the host VCP wise.

Then there's HID. Lots to learn!

But I'll get there.

shingadaddy
Senior
Posted on October 27, 2016 at 23:46

Dead stop at 3 for the moment. B type USB connector tied to NUCLEO board CN10

pin12 DP (PA12  -45)

Pin 14 DM (PA11 -44)

Pin 20 GND

Pin 21 Vbus (PA9 -42)

CDC Project from EVAL board APPLICATIONS folder compiled and binary transferred to NUCLEO board. (STM32L476)

Plug in and no detection occurs.

Probably need to check clocking sources on this NUCLEO and see if I have the needed ones connected / running.

Hmmm forgot to go get updated Cube 1.5.  (still have 1.2)

Anyone seeing me diving off in the weeds - speak up.

.

shingadaddy
Senior
Posted on October 28, 2016 at 00:15

Hm.... clive1, you are so clever that you already answered my question withoutANSWERING IT HERE !

https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a//my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Virtual%20Com%20Port%20on%20Nucleo-F072RB&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentview...

''On the Nucleo board you can use the 8 MHz, crystal based source, provided by the ST-LINK chip.''

Found by searching ''NUCLEO and USB''

I QUIT - Well for TODAY anyway. 🙂

.

shingadaddy
Senior
Posted on October 29, 2016 at 00:11

Interruptions abound but.. Worked on it SOME today-

Got CubeL4 1.5.2 downloaded

Sure enough there are some USB examples in the NUCLEO offerings now. (Apparently NO CDC yet though)

So used EVAL CDC project again. Modified PCB jumpers for clocking.

Installed jumpers SB50 and SB16 to get 8MHZ from STLinks F103 debugger.(MCO) Scope confirmed! Nice 8Mhz on one leg of R35 so it should be on U5 too (STM32L476RG)

Selected HSE clocking setup in main. Ran into some TrueStudio oddities there. Might reload everything again and try it over. Anyway -

No USB activity when plugged in. Still something wrong I guess. 5.1VDC appears at CN10 pin 21 PA9 VBus semse. I need to see what package the micro is on the EVAL board to see if it is this little 64 pin like on my NUCLEO. Might be still set up wrong since the demo came from EVAL and not NUCLEO.

Might try loading one of the NUCLEO HID demos and see if it just pops into life.

More as I Stumble through it. Suggestions appreciated. Have a good weekend.

shingadaddy
Senior
Posted on December 02, 2016 at 00:25

Follow on if interested.-

[DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/CubeL4%20Eval%20USB%20DEVICE%20CDC%20standalone%20-%20Truestudio%206&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&TopicsView=https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/AllItems.aspx&currentviews=51]https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex%5fmx%5fstm32%2fCubeL4%20Eval%20USB%20DEVICE%20CDC%20standalone%20%2d%20Truestudio%206&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&TopicsView=https%3A%2F%2Fmy%2Est%2Ecom%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2Fcortex%5Fmx%5Fstm32%2FAllItems%2Easpx&currentviews=51