2023-01-16 02:57 PM
I just need a basic USB HELLO WORLD code example that works.
I have tried a few step by step examples that were for other boards and one I found specifically for the F767zi, but my windows machine does not even see an Error connecting, it acts like nothing is connected.
Here are the basic steps I have tried to follow:
Start a new project:
Select the board "Nucleo-F767zi"
Connectivity - USB_OTG_FS- Mode=Device Only.
Clock Config: Input 8 mhz. yielding USB 48mhz. (allowed auto Resolve to fix all conflicts)
Middleware: USB_Device: class for HS IP (Disable),
Class for FS IP (Communication device class (virtual Port Com)
Build the config code.
the user includes are:
#include "main.h"
#include "string.h"
#include "usb_device.h"
however, there are USBD_CDC.H and USBD_CDC.C in the project files that are not called. I am just guessing they are referenced in one of the other modules. no example I have found mention adding them to the includes.
Without any additional code, the online examples say this should establish a basic connection. One demo included a transmit, but nothing happened.
Mainly because I could not find a COM port to connect to with putty.
In the infinite while(1) { } loop.
uint8_t buffer[] ="Hello World!\r\n";
CDC_Transmit_FS(buffer,sizeof(buffer));
HAL_Delay(1000);
I am using a tested and known good USB cable. I am plugged into "User USB CN13" There is a green light (VBUS LD8) that lights up when I plug in.
As I have said, the PC (windows 10) is ignoring the connection as if nothing is connected at all.
I have completed the "Blink" and "Blink with button press" demos. I even tried out PWM diming of the LEDS to check out the timers. I am sure I am missing something obvious. The Chip and Nucleo boards are completely new to me and my previous MCU experiences may be clouding my perception.
Thanks,
-Mike
2023-01-17 01:11 AM
Hi @Rover,
2 ready to use USB device examples dedicated for Nucleo-f767zi are available under Github repository of STM32CubeF7 package, and precisely: STM32CubeF7/Projects/STM32F767ZI-Nucleo/Applications/USB_Device.
If you would like to build your own example, I suggest you to follow videos shared in this discussion.
-Amel
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-01-17 01:22 AM
> but my windows machine does not even see an Error connecting, it acts like nothing is connected.
What you can see on Windows side depends on the device class.
If a device had errors enumerating, Windows would show something (at least this is the default behavior). That you see nothing at all can mean either that enumeration is successful or not started at all. Can you see it in Device Manager, View -> devices by container ?
2023-01-17 11:44 AM
Thank you for the quick reply. I am interested in the HID interface also so I may try that example out. My main focus is the Com device right now.
I looked at the GIT and could see all the files, but the project file was not included. I tried to copy all the files to a blank project, but I was having trouble getting all the includes It appears that I need to select Middleware options to add the includes., but when I build the config source code, it seems to mess up some part of the downloaded code. Is there a easier way?
2023-01-17 12:01 PM
Thank you Pavel for the response, Under device manager I can see the STlink com port from the programming port. Based on the USB configuration on the middleware setup, the user port should have the ID :"STM32 Virtual ComPort"
I tried rescanning, unplugging and replunging, and moving to a different USB port.
I believe you are correct, the USB is not being enumerated, Most likely because the USB code on the Nucleo is not set up correctly.
I just found this video last night and tried it.
USB COMMUNICATION DEVICE(VIRTUAL PORT) || STM32F4 ||STM32CUBEIDE. - YouTube
I followed it step by step except where the chip and board hardware differed. on the Nucleo-F767zi, PA11 and PA12 are connected to CN13. But it did not work.
I found the circuit diagram for the board. I don't see any jumpers on the DM and DP lines that could disable CN13. I am starting to suspect the VBUS or ID lines. That is assuming I am not overlooking something glaringly obvious. And that is where my real suspicion lies. Most likely a faulty Keyboard manipulator.
2023-01-17 10:45 PM
Hi @Rover ,
You can download the STM32CubeF7 package from this link: https://www.st.com/en/embedded-software/stm32cubef7.html.
The USB examples will be located at the same path as in Github.
-Amel
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-01-19 03:52 PM
Hi @Amel NASRI
I really do appreciate the help you are offering. I did download the file you linked. If I figure out how to use it, that will be a treasure trove of useful examples to learn from.
As I said earlier, I would like to use the HID mode at some point, but the VCP is my primary focus. Looking at the USB applications under: STM32Cube_FW_F7_V1.17.0\Projects\STM32F767ZI-Nucleo\Applications\USB_Device ,
There are two folders:
HID_standalone
MSC_Standalone.
The HID is for Human Interface devices such as Mice and keyboards.
The MSC is for memory devices for storage or file transfers.
I did not see a VCP option in the directories.
AS I may learn something from any working USB demo, I looked at the HID directory, I am still getting familiar with the project storage system in the CUBEIDE. Most systems I have used create a project file that is usually just a list of the related files in a project and some other meta data.
It looks like Cube has a collection of these files. There is one for the C Code called .cproject, another for the overall project just called .project. Still another called .mxproject. I think the master project file ends in .ioc... As in, TryingUSBvcp16.ioc
I will try to find an instructions, but I can't see how the files in the GIT or the downloaded folder can be set up as a project in Cube. I can only guess that I need to start a blank project and then copy the files into the folders. I took a few guesses, but I was not able to compile my results as the libraries were not linking.
Sorry for the long post. I just wanted to be clear as to what I am trying and where I am getting stuck.
Thank you again.
2023-01-21 02:42 PM
I don't have the time needed to really hammer away at this. But here is what I have uncovered today.
I found very good video by a creator named Edison. (link in the attached txt file)
He builds exactly the type of demo application I would like to get working, but he uses the Nucleo-F446RE board. I am trying to use the NUCLEO-F767zi board. I would not expect that much difference between them, but there must be something.
I typed out every step he takes. The only changes I made were;
- the PIN he selected for the LED
- the Board selection at the start of the project.
- not hard-wiring a USB cable to the jumpers. I am using PA11 and PA12 which are the defaults in USB_OT_FS. And then plugging my USB Cable into CN13.
The attached text file includes the steps I typed out from the video as I followed them, and the text for files "USBD_CDC_IF.C" and "MAIN.C"
If anyone can check my work, I would very much appreciate it.