USB driver for STM32l100rc using HAL library - c

Is there anyone who has worked on STM32L1 series. I'm working on STM32L1xx series and wanted to write USB driver for it. Is there any example for USB driver for STM32L series or anyone worked on STM32L1xx series? Any help will be appreciated.
Thanks in advance.

You need these works to do:
1.USB client driver on STM32. There are lots of available codes in github or other website;
2.SDcard driver. Normally SDCard has two modes, include SPI mode and SD mode, the operation will be simplified a lot in SPI mode, however, in SD mode the speed will more faster than SPI mode. you can refer to datasheet for more information.

Download STM32CubeMX
Download STM32CubeL1
Start new project for your device, choose peripheral, choose device class for MSC
Setup clock for USB
Export project
Configure SPI for your SDCARD (SDIO is not available) for interface between USB device stack and SDCARD sector read on PC demand.
This are key steps to do, as I don't know what you know so far (looks like nothing) and what you have learn yourself so far (looks like nothing) I'm unable to give you comprehensive answer.

Related

Beaglebone Black won't show-up as /dev/ttyUSB

I am trying to learn Linux by following instructions in "Mastering Embedded Linux Programming" by Chris Simmonds. By following the book and with some help from Stack_Overflow_1, i was able to build the MLO and u-boot.img.
However, when i connect USB cable to my PC and execute the ls /dev/tty* command, i cannot find any device with /dev/ttyUSB. All i can see are devices with /dev/tty0-63, /dev/ttyS0-31 and one /dev/ttyprintk.
Also, when i press down the S2 button and connect the USB cable, i can only see the power led glowing and nothing else.
I have properly built the u-boot (three attempts to get it right).
Also, as per the instructions in the book, i am only testing the u-boot stuff and yet to reach the kernal part.
If i remove the sd card and connect the USB, im an able to talk to my BBB over ssh (192.168.7.2).
How to i get the u-boot to work? Thank you!
If you don't have one yet, I'd recommend to get a USB-to-serial device (3.3V Vref). You connect it to the debug UART (J1) which is located next to the P9 side. Nowadays those are very cheap and can cost below 1$. Ones that feature a genuine FTDI part will be 5-10$ at least.
The serial port you are referencing is only available once the device has passed through U-Boot, booted the kernel and finally userspace has set up the communications.
Especially when working with U-Boot and the Kernel, low level UART access is crucial.
As a further note, could it be that the Book refers to the (white) original Beaglebone? That has a FTDI USB-to-UART chip on board and will allow you even U-Boot access. You can do the same things if you have the above mentioned USB device.
https://groups.google.com/g/beagleboard/c/eNDjK05spY8/m/GPvhcP52BAAJ shows that one needs to hold the space key to enter u-boot.
Also, the info. here might be more up to date compared to the book.
https://www.digikey.com/eewiki/display/linuxonarm/BeagleBone+Black
There is no way to copy and paste everything from the eewiki. I just left you the link. Enjoy!

Serial Port Terminal

I am programming a MAX32 Micro controller in MPLAB. I want to use the UART protocol to interact with my terminal (I am developing on a mac). Is this possible? Can someone point me in the right direction to get started?
Read Wikipedia UART Article
Read Reference Manual of your µC, Chapter "...UART..."
Get example Code for this issue from your Reference Manual or Programming Manual or Internet Articles
Program your board
Connect your Board with your PC via Cable (USB, RS232 to USB (virtual RS232) or UART to USB)
Open Terminal Program i.e. TeraTerm
Check your Settings i.e. Baud Rate
Try it

Device Driver programming - USB

I have to discuss the codeflow of the USB host controller. This USB host controller is the interface between the device and the OS. There are numerous USB devices (eg.keyboard,camera,mouse,etc).
Where will I find the code to see how the communication between the USB device and OS happens through the USB host-controller ?
Download the Linux kernel source code, and start reading the code in drivers/usb. Here an online reference, and the README about the USB-tree
I suggest you to take a look at USB host controller specifications - UHCI/OHCI/EHCI/XHCI because this knowledge will be necessary to understand whole USB stack in linux kernel.
You may also download some example sources provided by several embedded microcontroller producers (i.e. Atmel). Probably those drivers will be easier to analyse than linux sources.

Regarding Vcom on LPC1769

I am using the ARM-based microcontroller LPC1769 and the LPCXpresso IDE. I am using an example project for Vcom using USB Device controller in 1769. By default it works at 9600 baud. But I don't understand how to change the baud rate - I want to use it at higher baud rate.
Please define every thing well for better answer, I am providing the computer side answer,
If you are connection with Computer, Its using generic Com port which will be assigned to the device,
now, again if you are using computer, the com port have configuration. go to device manager, and see properties>> Configuration>> there you will see baud rate.
go and change that,
that will do. :)
Edit: Updated with links of support in Driver Side,
I have few link for the same VCP(Virtual Comp Port) Drivers you can use
http://www.ftdichip.com/Drivers/VCP.htm
and Documentation for the same in different different case, please refer documentation first :)
http://www.ftdichip.com/Support/Documents/DataSheets.htm
this is all from my side :)

How to do this: embedded USB-Host communication with plugged USB-Device

I am currently practising with USB programming on an AT91SAM9G20-Evaluation Kit. I learned much about USB devices and USB device port drivers while "playing" with the ATMEL provided USB device port projects (CDC-driver, ..).
But now I'd like to write a small driver to controll a wireless stick
which I plugged into one of the boards USB-A Host Ports.
I read a lot on Stack Overflow, the OpenHCI specification and even found some libraries on the net, but I am not sure if it's a good way to implement my own stack without any "good" knowledge in USB Host Port programming.
Is there a small and easy way to control the wireless-stick at the boards USB Host port? (like using the USART-Interfaces?).
I am also keen to hear hints on how to implement RTUSB or libUSB in to the AT91.
You can download AT91LIB version 1.9 from atmel from this page
The usb host libraries are under at91lib/usb/host. They're not the complete package you need though since they're just the OHCI driver -- you still need a USB driver and class drivers to implement what you want.
You could try an RTOS with USB Host support like rt-usb32

Resources