Mar 02, 2015 But, it provides at least another really useful feature: a Virtual COM port. When you install the ST-Link drivers, a new device appears in your hardware devices list: the ST-Link Virtual COM port. If you use a Linux PC or a Mac, you'll find a new terminal in the /dev directory. Usually, this device is named something similar to tty.usbmodemXXXX. In a second step, the “CDC DEVICE” driver needs to be installed: Press the “Reset” button on the target board; Note: If an older driver was already assigned to the board, or the Windows system has automatically assigned a driver to the STM32 board, e.g. In “Ports (COM &.
The WF200/WFM200 Wi-Fi Expansion Board is the best and fastest way to explore the capabilities of the WF200 Series of Wi-Fi Transceivers.The kit contains an expansion board that can be connected to a STM32 MCU starter-kit.The expansion board allows the STM32 MCU to connect to a WF200/WFM200 Wi-Fi module, which can connect to Wi-Fi networks, but also be an Access Point to which other devices can connect.
This document describes how to connect the WF200/WFM200 Wi-Fi EXP Board to a STM32 MCU and run the demonstration.
This demonstration runs the Wi-Fi Full MAC driver meant to communicate withthe WF(M)200 Silicon Labs Wi-Fi transceivers.
Naming convention
- SoftAP: WF(M)200 configured in Wi-Fi Software-enabled Access Point mode
- Station: WF(M)200 configured in Wi-Fi Station mode
- AP: Any 'home network' or 'office network' Wi-Fi Access Point
- Device: The PC or phone used to access the demo
Requirements
Hardware Prerequisites
The WF200 Wi-Fi Expansion Board contains a Wi-Fi module. To use the board, an MCU starter-kit is required, where the MCU will be the host that communicates and controls the Wi-Fi module.
- One of the two Wi-Fi® expansion kits listed below:
WF200 Wi-Fi® Expansion Kit SLEXP8022A | WFM200 Wi-Fi® Expansion Kit SLEXP8023A |
- An Arduino/NUCLEO interposer (Available through support ticket request,more information in the Additional Resourcessection) or some flying wires
- A NUCLEO-F429ZI development board
- A micro USB cable
- A PC to load a binary file in the NUCLEO board or to compile the IAR/TrueSTUDIO projects. In addition, it can be used to test the example if it is equipped with a Wi-Fi interface.
Software Prerequisites
In addition to the previous hardware, a user needs software listed below:
- The software example named F429ZI_freertos available on GitHub
- Licensed IAR Embedded Workbench IDE for ARM installed or Atollic TrueSTUDIO for STM32 IDE
- The correct ST-link driver installed on your machine
- A Serial terminal to communicate with the NUCLEO-F429ZI board. For example, Tera Term or Putty
Set up your Kit
After you have the above resources, follow the steps described below (you can refer to the image below):
- Connect the Arduino/Nucleo interposer board to the NUCLEO-F429ZI board.
- Connect the WF200 expansion kit to the Arduino/Nucleo interposer board.
- Make sure the 'Power' switch on the WF200 expansion kit is in the [On Board LDO] position.
- Select [SPI] or [SDIO] on the bus switch depending on the bus you want to use.
- Connect the NUCLEO board to your PC using the USB cable. The board should appear as a mass storage device named 'NODE_F429ZI'.
Clone the GitHub Repository
- The example is hosted at GitHub. To download a copy of the example, go to the following link: https://github.com/SiliconLabs/wfx-fullMAC-tools. Press the Green button [Clone or Download] on the right side to download the repository as a zip file.
- After the download is complete, extract the zip file to a folder on your PC with a short name to avoid any issues with long path names (e.g. C:).
Flash the STM32 MCU
Use the Binary Files
The first option to run the demonstration is to use the precompiled binaries provided under wfx-fullMAC-tools/Examples/STM32/commissioning/F429ZI_freertos/Binaries/. Depending on the bus selected on the switch, choose the corresponding binary file:
- F429ZI_freertos_spi.bin
- F429ZI_freertos_sdio.bin
Stm32 Virtual Com Port Device Driver For Mac Download
To use this method, drag-and-drop or copy the F429ZI_freertos_XXX.bin file to the 'NODE_F429ZI' mass storage.
After the STM32 is successfully flashed, jump to the Start the Example section.
Compile the Project
Alternatively, use your preferred IDE to compile and flash the project into the NUCLEO board.
![Stm32 Virtual Com Port Device Driver For Mac Stm32 Virtual Com Port Device Driver For Mac](/uploads/1/2/6/3/126365712/937094039.jpg)
- Open the project with either IAR or TrueSTUDIO IDEs.
- Select the bus configuration (SPI or SDIO). Make sure it matches the switch position on the WF200 EXP board.
- Build the project.
- Flash the project to the NUCLEO-F429ZI board.
After the STM32 is successfully flashed, jump to the Start the Example section.
Start the Example
- While the toolchain builds the project and launches the debug session, open the Device Manager in Windows OS to see the COM Port Number assigned to the USB device [STMicroelectronics STLink Virtual COM Port].
- Open a Serial Terminal application, such as PuTTY, configure it to the COM Port Number you found in the previous step, and set the UART settings to 115200 bps, 8 data bits, 1 stop bit and no parity.
- Reset the NUCLEO board using the black button.
- Watch the application’s progress on the Serial Terminal. Wait 5 seconds if you want to use the default settings. The application will go through the following stages before it is ready:
You are ready to move to the Wi-Fi commissioning demonstration page.
As I continue my journey with STM32 development, I wanted to share my findings with how to get a Virtual COM Port (VCP) working with a Nucleo board.
Specifically, I’m using the Nucleo-F042K6, as it has a built-in USB device peripheral (full speed), and it does not require an external crystal. I highly recommend looking over the USB Hardware and PCB Guidelines document from ST Microelectronics to learn about what’s needed for your particular STM32 part. Note that if you are using a Nucleo board with an STM32F401 or STM32F411, you will need to solder an external crystal to the board, as it is unpopulated on those boards.
To begin, strip a USB cable or get a USB breakout board (like this one from SparkFun) and connect the lines to a breadboard as shown in the Fritzing diagram below. Make the following connections:
- VUSB → Diode → Nucleo 5V (don’t want to short something if we’re plugging in 2 USB cables!)
- USB D- → Nucleo D10 (PA11)
- USB D+ → Nucleo D2 (PA12)
- USB GND → Nucleo GND
- USB GND → USB Shield (don’t know if this is necessary, but it makes me feel better)
Also, this is super important: remove the jumper that comes default on your Nucleo board! It bridges D2 and GND and will short out our D+ line if left in place.
Plug the two USB cables from the Nucleo board into your computer. We’ll be sending our compiled program over to the ST-LINK side of the board, and the VCP will enumerate on the USB lines that we just added. I don’t have a bootloader working (yet) to where we can send binary files over VCP, but that’s on my to-do list.
For this, I’m using STM32CubeIDE along with the STM32F0 HAL API.
In STM32CubeIDE, start a new project (File > New > STM32 Project). Choose your part or board. I’ll pick the Nucleo-F042K6, since that’s the board I have.
On the next screen, give your project a useful name (such as “nucleo-f042k6-vcp-test”). Leave everything else as default. We’ll be using C as our language for this example. Click Finish, and you’ll be asked a few questions:
- Yes to “initialize all peripherals with their default Mode”
- Yes to “open this perspective now”
In the CubeMX configuration perspective, you’ll need to enable a few options to initialize the USB as a Virtual COM Port. In the Pinout & Configuration tab, go to Categories > Connectivity and click USB. Enable Device (FS). You should see PA11 and PA12 be automatically configured for USB_DM and USB_DP.
Under Categories > Middleware, select USB_DEVICE. Change Class For FS IP to Communication Device Class (CDC). This tells the USB stack that we want to enumerate as a CDC device, which will allow us to send serial data to and from our computer across the USB lines.
Stm32 Virtual Com Port Device Driver For Mac Windows 7
Click on the Clock Configuration tab. The software will tell you that your clocks have issues. By default, the Nucleo-F042K6 board is configured for 8 MHz clocks for almost everything. We need to bump those up to 48 MHz for USB to work. Luckily, you can just click Yes on the pop-up when asked to run the automatic clock issues solver. This should automatically change all of the necessary clocks to 48 MHz.
In the Project Manager tab, change the Minimum Heap Size to 0x100. The STM32F042K6 comes with 6 kB of RAM, which isn’t a whole lot. USB functionality takes up probably 2-3 kB worth of that memory, so we need to be careful about how we use the rest.
We can free up some space by adjusting the minimum heap and stack sizes. These parameters essentially reserve sections of data memory for the heap and stack. By setting 0x200 and 0x400, we’ve told the processor to reserve 1 kB of RAM for the heap and stack, respectively. We need to lower one of them in order to accommodate the USB functions. I chose heap, as it seems less likely we’ll be using dynamically allocated memory for this application.
If you get an error message like `._user_heap_stack’ will not fit in region `RAM’ or region `RAM’ overflowed by 64 bytes when you compile, it means you are running out of RAM in your application. You will need to go into the Device Configuration Tool (the .ioc file) and adjust the stack and heap settings as described above. Alternatively, you can go into the .ld linker script and look for the _Min_Heap_Size and _Min_Stack_Size settings there (just know that this file will be overwritten if you make changes in the graphical Device Configuration Tool).
Click File > Save to save the changes to the CubeMX configuration. You’ll be asked if you want to generate Code. Click Yes.
In your project files, navigate to the Src directory. Notice that you have several USB-related files that have been added. usbd_cdc_if.c contains the functions that allow us to send and receive serial data using the USB Communication Device Class. Feel free to peek in there, if you wish.
Open up Src > main.c. At the top, under /* USER CODE BEGIN Includes */ , enter the following line:
This will let us call functions from the CDC library. Scroll down to our while(1) loop in main. Under /* USER CODE BEGIN 3 */ (but still inside the while loop), enter the following:
Here, we create a simple string and call a USB CDC function to send out that string over the USB lines. We then wait for 1 second before repeating this action ad infinitum.
Click Project > Build All to build the project. Click Run > Debug As > STM32 MCU C/C++ Application. A pop-up window will appear asking you to create a new launch configuration. Note that if you are not using a Nucleo board or an ST-LINK, you can change the hardware debugger (e.g. to a Segger J-LINK) in the Debugger tab. If you are using a Nucleo, leave everything as default and click OK.
If asked to switch to the Debug perspective, click Switch. When the new perspective opens, click Run > Resume (or the play button on the toolbar).
Your code should now be running, and the microcontroller will enumerate as a USB device! Feel free to verify the new serial port in your OS’s device manager. This should show up as a USB serial or COM port.
Open your favorite serial terminal program, and enter the following connection details:
- Port: USB serial or COM port discovered above
- Baud rate: 9600
- Data bits: 8 (default)
- Parity: None (default)
- Stop bits: 1 (default)
Open the serial connection, and you should be greeted by that oh-so-familiar phrase, repeating over and over again:
When you’ve had enough strings, feel free to press the stop button in the IDE to stop the program from running on the STM32.
Interestingly enough, the STM32 seems to support autobaud detection by default. Try changing the serial terminal’s baudrate to anything else and see if you can still receive text. I bet that disabling autobaud would save some RAM, but I have not discovered how yet.
From what I understand, CDC_Receive_FS() is a callback, so you’ll need to change its definition in usbd_cdc_if.c to get it to work. I haven’t played with it yet, so that’ll be a post for another time.
I hope that this helps you get started with your STM32 USB journey!