Rawcoco
Overview
A capacitive touch sensing USB device.
A 32-bit version/descendant of the Cocomake7.
A work in progress prototype to learn more about ARM dev, STM32 peripherals and compare results with the AVR and teensy based versions.
The goal is to make a versatile, affordable and playful interface device, that can be used as a creative basis for interactive (non-usb) playthings, DIY projects and electronics/interaction/game dev workshops.
Hardware
General Notes
Microcontroller:
- STM32F042F6P6
- Crystal-less USB with integrated USB (fullspeed) PHY
- Capacitive touch sensing peripheral
- Cost: ~$2 on Aliexpress (Chips Store)
Revision 0.03
A test PCB with 6 touch pads lined up in a row. Easy to breakout, by cutting the PCB traces...
No USB (ESD) protection, no line termination resistors (D+/-), no filtering, optimized for simplicity, size and cost.
Features
- 6 touchpads
- micro USB port
- debug LED
- I2C / SWD connector
BOM
Reference Value Footprint Digikey Comment Count Unit Cost SUM rawcoco:U1 STM32F042F6Px w_smd_dil:tssop-20 STM32F042F6P6-ND not available 1 1.48 EUR 1.48 EUR rawcoco:U2 TLV70033DDCR w_smd_trans:sot23-5 296-27937-1-ND 1 0.48 EUR 0.48 EUR rawcoco:C1 100n mylib:c_0402_mod0 490-10777-1-ND 1 0.09 EUR 0.09 EUR rawcoco:C8 C9 1u mylib:c_0603_mod0 490-6423-1-ND 2 0.09 EUR 0.18 EUR rawcoco:C10 C11 1n mylib:c_0402_mod0 490-6349-1-ND 2 0.09 EUR 0.18 EUR rawcoco:D1 LED w_smd_leds:Led_0402 511-1651-1-ND 1 0.41 EUR 0.41 EUR rawcoco:R1 470R mylib:r_0402_mod0 CR0402-FX-4700GLFCT-ND 470 Ohm 1 0.09 EUR 0.09 EUR rawcoco:R7-R12 1k mylib:r_0402_mod0 CR0402-FX-1001GLFCT-ND 6 0.09 EUR 0.54 EUR rawcoco:CON1 USB-MINI-B_mod0 mylib:conn_usb_B_micro_smd-2_mod0wHoles WM17141CT-ND 1 0.91 EUR 0.91 EUR rawcoco:K1 K2 CONN_3 mylib:pin_header_3x1_1.27mm_pitch 2 0.00 EUR 0.00 EUR rawcoco:P1 P2 CONN_4 mylib:pin_header_4x1_1.27mm_pitch 2 0.00 EUR 0.00 EUR rawcoco:P4-P6 CONN_1 mylib:pin_header_1x1_1.27mm_pitch 3 0.00 EUR 0.00 EUR SUM 22 4.36 €
Digikey BOM (MCU not included):
1,296-27937-1-ND,rawcoco:U2 1,490-10777-1-ND,rawcoco:C1 2,490-6423-1-ND ,rawcoco:C8 C9 2,490-6349-1-ND,rawcoco:C10 C11 1,511-1651-1-ND,rawcoco:D1 1,CR0402-FX-4700GLFCT-ND ,rawcoco:R1 6,CR0402-FX-1001GLFCT-ND,rawcoco:R7-R12 1,WM17141CT-ND,rawcoco:CON1
PCB
Get it at: OSHPark
Pinouts
SWD Pinout (topview, USB plug on the left):
- VDD
- SWCLK
- VSS
- SWDIO
Touchpad (TSC) order (topview, USB plug on the left):
- G1_IO4
- G1_IO3
- G1_IO2
- G2_IO4
- G2_IO3
- G2_IO2
Errata / Known Bugs
- tie PB8 to ground -> BOOT0
Software
Currently used/evaluated tools and sources to get the board up and running:
- Free tools for ARM development (gcc-none-eabi toolchain, OpenOCD)
- STM32CubeMX and sample code by ST
- Code::Blocks as an IDE
More notes are collected here...
USB HID Device
Status: Mouse, Keyboard, Gamepad HID devices are working.
The generated code from STM32CubeMX was really helpful here. The HID report descriptor had to be modified in order to get keyboard and gamepad recognized by the OS.
This tutorial was helpful: http://eleccelerator.com/tutorial-about-usb-hid-report-descriptors/
The official doc as well: http://www.usb.org/developers/hidpage/HID1_11.pdf
The HID Descriptor Tool there comes with good examples and a validator plus exporter (header file...): http://www.usb.org/developers/hidpage/
Keyboard Test
This is the current test setup to send out keyboard keys from A-F. All six keys can be pressed at once... Funny, that the Keyboard HID descriptor can store six keys at max...
Current problem: The sensitivity of the keys and fine tuning of the TSC peripheral needs to be investigated more...
USB MIDI
Not working (yet). USB MIDI devices are more complicated to implement (USB Audio Device Class, MIDIstreaming)...
USB Serial (CDC)
Characters can be sent!
Info
Links
Various links...
- http://www.usb.org/developers/
- http://www.usb.org/developers/hidpage/
- http://eleccelerator.com/tutorial-about-usb-hid-report-descriptors/
- https://github.com/axoloti/axoloti/blob/master/firmware/usbh_conf.c
- https://github.com/axoloti/axoloti/blob/master/firmware/midi_usb.c
- http://eleccelerator.com/tutorial-about-usb-hid-report-descriptors/
- https://github.com/MaJerle/stm32fxxx_hal_libraries/tree/master/00-STM32_LIBRARIES
- http://stm32f4-discovery.com/2014/09/library-34-stm32f4-usb-hid-device/
- http://electronics.stackexchange.com/questions/45635/usb-midi-interface-with-stm32f4-discovery
- https://github.com/sebseb7/stm32-midi-demo
- http://www.ucapps.de/mbhp_core_stm32.html