This week, I worked on Schematics, PCB and USB Keyboard.
Schematics
We finished first schematic version of each device. I updated some details on schematics before to begin all PCB.
I also added a spreadsheet of the STM32Fxx pin functions. Finally, I added a file in the wiki about the power supply of each component.
USB Keyboard
I started to work on the USB Keyboard Issue. The goal is to plug a PC to an STM32 (Olimex OTG1 port) and to plug the same STM32 (Olimex OTG2 port) to a USB Keyboard. The PC has to detect a keyboard without to see the STM32 between both. The STM32 has to get all USB Keyboard interaction as descriptors and interrupt to send it to the PC.
The first step would be to get USB Keyboard descriptors and show it on the RTT connection. However, I’m still working on this step.
I started to check the Olimex board connection to know jumper position and I updated the file board.h correctly.
USB protocol
I read documentations about the USB standard from the official website, some blogs as site OUAIBE de la BIDOUILLE and some forums. I got knowledge about how USB works. There are four types of communication : control, bulk, interrupt and isochronous. Note that Keyboard works with interrupt.
Each communication is constructed with different packet:
- Token
Sync | PID | ADDR | ENDP | CRC5 | EOP |
8bits | 2x4bits | 7bits | 4bits | 5bits | 3bits |
- Data
Sync | PID | DATA | CRC16 | EOP |
8bits | 2x4bits | 1024bits | 16bits | 3bits |
- Handshake
Sync | PID | EOP |
8bits | 2x4bits | 3bits |
- SOF (Start of Fram)
Sync | PID | FramNumber | CRC5 | EOP |
8bits | 2x4bits | 5bits | 3bits |
Finally, there are four descriptors : devices, configuration, interface and endpoint descriptors. Each descriptors has field contain information about the device. The PID, VID, consumption, type of communication, etc.
USB on ChibiOS
My difficulties are to implement that on the STM32 and more specially with the OS we choose: ChibiOS.
I got back usbcfg from ChibiOS/testhal/STM32/STM32F4xx/USB_CDC_IAD/
This example uses two SerialUSBDriver SDU1 and SDU2 but not as a host.
I found another example at ChibiOS/community/testhal/STM32/STM32F4xx/USB_HOST/ which logically implement what we need. Nevertheless, the code is very hard to understand and is not possible to compile it. I try to debug the Makefile, but there are too many errors. I will continue to read ChibiOS documentation, code and forum to find a solution.
Next week
Next week, I will finished the spy talk PCB and continue to work on the USB Keyboard Issue.
Recent Comments