Rawcoco: Difference between revisions

From SGMK-SSAM-WIKI
Jump to navigation Jump to search
No edit summary
Line 171: Line 171:
Characters can be sent!
Characters can be sent!


= Notes =
== Remarks / Conclusions ==
The STM32's Touch Sensing Controller (TSC) peripheral can be handled with not too much effort, and gives stable and fast measurements.
A good explanation of the principles behind that charge transfer acquisition technique can be found in [http://www.st.com/st-web-ui/static/active/en/resource/training/technical/product_training/STM32L4_Peripheral_Touchsense.pdf that presentation]... Nicely explained. It can acquire multiple channels at the same time (not tested yet), and can be tuned to run independently of the main program using interrupts.
[[File:STM32_tsc_doc0.jpg]]
== TODOs ==
* USB MIDI (maybe)
* Test multiplexing with 4051 to increase the number of touch channels.
* Read more about tuning the clock settings and various parameters to tune the TSC.
* Clean up code, throw unnessary things out. Make library...
* Combine USB HID and Virtual Serial Port (CDC), and try to write a boot loader that reprograms the flash over USB serial.
* Demos.


= Info =
= Info =
Line 219: Line 237:


* http://codeandlife.com/2012/06/18/usb-hid-keyboard-with-v-usb/
* http://codeandlife.com/2012/06/18/usb-hid-keyboard-with-v-usb/
* http://www.st.com/st-web-ui/static/active/en/resource/training/technical/product_training/STM32L4_Peripheral_Touchsense.pdf

Revision as of 06:01, 27 March 2016

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 (Electronics)

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(/0.04)

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

Circuit

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 €

REM: That price is the actual price on DigiKey for all the parts on the PCB. It is obvious, that 41 cents for an LED is way too much, so that the price can probably be lowered to about 3 Euros. The MCU is certainly the most expensive part...


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


KiCad project with gerbers. BOM spread sheet and schematics (rev0.04 but it's actually the same as rev0.03): rawcoco_rev0.04_local.zip

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


Hardware (Enclosure)

OnShape project

STLs: rawcoco_case1_2016-03-27.zip

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 helpful. Basically only the HID report descriptors had to be modified in order to get keyboard and gamepad recognized by the OS.

This tutorial was also quite insightful: http://eleccelerator.com/tutorial-about-usb-hid-report-descriptors/

The official doc USB HID 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...


Here's the still very messy test project (Code::Blocks with Makefile): rawcoco_cb_touchHID6_2016-03-27.zip

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!


Notes

Remarks / Conclusions

The STM32's Touch Sensing Controller (TSC) peripheral can be handled with not too much effort, and gives stable and fast measurements. A good explanation of the principles behind that charge transfer acquisition technique can be found in that presentation... Nicely explained. It can acquire multiple channels at the same time (not tested yet), and can be tuned to run independently of the main program using interrupts.

TODOs

  • USB MIDI (maybe)
  • Test multiplexing with 4051 to increase the number of touch channels.
  • Read more about tuning the clock settings and various parameters to tune the TSC.
  • Clean up code, throw unnessary things out. Make library...
  • Combine USB HID and Virtual Serial Port (CDC), and try to write a boot loader that reprograms the flash over USB serial.
  • Demos.

Info

Links

Various links...