Rawcoco: Difference between revisions

From SGMK-SSAM-WIKI
Jump to navigation Jump to search
mNo edit summary
 
(11 intermediate revisions by the same user not shown)
Line 20: Line 20:




== Revision 0.03 ==
== 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...
A test PCB with 6 touch pads lined up in a row. Easy to breakout, by cutting the PCB traces...
Line 31: Line 31:
* debug LED
* debug LED
* I2C / SWD connector
* I2C / SWD connector
=== Circuit ===
[[File:Rawcoco_rev0.04_schematics_2016-03-27.png]]


=== BOM ===
=== BOM ===
<pre>
<pre>
Reference Value Footprint Digikey Comment Count Unit Cost SUM
Reference Value 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:U1 STM32F042F6Px 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:U2 TLV70033DDCR 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:C1 100n 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:C8 C9 1u 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:C10 C11 1n 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:D1 LED 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:R1 470R 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:R7-R12 1k R0402-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:CON1 1 1 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:K1 K2 CONN_3 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:P1 P2 CONN_4 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
rawcoco:P4-P6 CONN_1 3 0.00 EUR 0.00 EUR


SUM 22 4.36 €
SUM 22 4.36 €
</pre>
</pre>


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 Eur...  
REMARK: 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...




Line 85: Line 89:
[[File:rawcoco_rev0.03_A7e1a0047420d7dc076a6a2175629a03.png]]
[[File:rawcoco_rev0.03_A7e1a0047420d7dc076a6a2175629a03.png]]


KiCad project with gerbers. BOM spread sheet and schematics (rev0.04 but it's actually the same as rev0.03):
[http://0rel.com/prj/rawcoco/rawcoco_rev0.04_local.zip rawcoco_rev0.04_local.zip]


=== Pinouts ===
=== Pinouts ===
Line 107: Line 108:
* G2_IO2
* G2_IO2
[[File:rawcoco_rev0.01_tsc_pinout.png]]
[[File:rawcoco_rev0.01_tsc_pinout.png]]


=== Errata / Known Bugs ===
=== Errata / Known Bugs ===
* tie PB8 to ground -> BOOT0
* tie PB8 to ground -> BOOT0


= Hardware (Enclosure) =
= Hardware (Enclosure) =
Line 117: Line 119:


[https://cad.onshape.com/documents/56ef409ce4b02f6312a8a3e0/w/f64d206a80b0b0b6cfab6400/e/649c52126c99f548e3084220 OnShape project]
[https://cad.onshape.com/documents/56ef409ce4b02f6312a8a3e0/w/f64d206a80b0b0b6cfab6400/e/649c52126c99f548e3084220 OnShape project]
STLs:
[http://0rel.com/prj/rawcoco/rawcoco_case1_2016-03-27.zip rawcoco_case1_2016-03-27.zip]


= Software =
= Software =
Line 130: Line 129:


More notes are collected [[STM32_dev|here]]...
More notes are collected [[STM32_dev|here]]...


== USB HID Device ==
== USB HID Device ==
Line 135: Line 135:
Status: Mouse, Keyboard, Gamepad HID devices are working.
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 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.


The official doc as well: http://www.usb.org/developers/hidpage/HID1_11.pdf
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/
The HID Descriptor Tool there comes with good examples and a validator plus exporter (header file...): http://www.usb.org/developers/hidpage/
Line 145: Line 146:


=== Keyboard Test ===
=== 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...
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...
Line 153: Line 153:
[[File:rawcoco_rev0.03_tsc_test_pads.jpg]]
[[File:rawcoco_rev0.03_tsc_test_pads.jpg]]


Here's the still very messy test project (Code::Blocks with Makefile):
[http://0rel.com/prj/rawcoco/rawcoco_cb_touchHID6_2016-03-27.zip rawcoco_cb_touchHID6_2016-03-27.zip]


== USB MIDI ==
== USB MIDI ==
Line 165: Line 162:
Characters can be sent!
Characters can be sent!


= Notes =
== Remarks / Conclusions ==
The STM32's Touch Sensing Controller (TSC) peripheral can be handled without 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 configured to run independently of the main program using interrupts. Also, pin mapping and code generation in STM32CubeMX is very useful. It should also be possible make a "device independent" library that can be used on different STM32s, that have a TSC built in...
[[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 211: Line 226:


* http://hamaluik.com/posts/making-a-custom-teensy3-hid-joystick/
* http://hamaluik.com/posts/making-a-custom-teensy3-hid-joystick/
* 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

Latest revision as of 19:55, 14 April 2021

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		Digikey				Comment		Count	Unit Cost	SUM

rawcoco:U1	STM32F042F6Px	STM32F042F6P6-ND		not available	1	1.48 EUR	1.48 EUR
rawcoco:U2	TLV70033DDCR	296-27937-1-ND					1	0.48 EUR	0.48 EUR
							
rawcoco:C1	100n		490-10777-1-ND					1	0.09 EUR	0.09 EUR
rawcoco:C8 C9	1u		490-6423-1-ND 					2	0.09 EUR	0.18 EUR
rawcoco:C10 C11	1n		490-6349-1-ND					2	0.09 EUR	0.18 EUR
							
rawcoco:D1	LED		511-1651-1-ND					1	0.41 EUR	0.41 EUR
							
rawcoco:R1	470R		CR0402-FX-4700GLFCT-ND 		470 Ohm		1	0.09 EUR	0.09 EUR
rawcoco:R7-R12	1k		R0402-FX-1001GLFCT-ND				6	0.09 EUR	0.54 EUR
							
rawcoco:CON1	1	1	WM17141CT-ND					1	0.91 EUR	0.91 EUR
							
rawcoco:K1 K2	CONN_3								2	0.00 EUR	0.00 EUR
rawcoco:P1 P2	CONN_4								2	0.00 EUR	0.00 EUR
rawcoco:P4-P6	CONN_1								3	0.00 EUR	0.00 EUR

								SUM		22			4.36 €

REMARK: 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


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

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...


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 without 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 configured to run independently of the main program using interrupts. Also, pin mapping and code generation in STM32CubeMX is very useful. It should also be possible make a "device independent" library that can be used on different STM32s, that have a TSC built in...

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...