Skip to content
/ radius Public

A cheap (in quality) and cheap (in dollars) USB comms adapter: 10 pins of SPI/I2C/UART/GPIO.

Notifications You must be signed in to change notification settings

tcr/radius

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

radius

testing

make
make flash
make test

If OS X reports contention for your device:

sudo kextunload -b com.apple.driver.AppleUSBCardReader
sudo kextunload -b com.apple.iokit.IOUSBMassStorageClass

parts

Designator(s) Quantity Description Part Number
IC1 1 STM8S 8-bit micro (TSSOP-20) STM8S003F3P6
P2 1 10-pin right-angled header, .1" Pitch PPTC101LGBN-RC
U1 1 Full speed USB <-> 9-pin Serial (SOP-16) CH340G
U2 1 3.3V Regulator (SO-8) LD1117D33CTR
Y1 1 12Mhz Crystal NX3225SA
C1 1 0.1 uF (0603) ...
C2 1 10 uF (0603) ...
C3 1 1 μF polarized (0603) ...
C4, C5 2 20 pF (0603) ...

pin mapping

  • GND
  • 3.3V
  • SCL - PB4
  • SDA - PB5
  • SCK - PC5
  • MISO - PC7
  • MOSI - PC6
  • TXD - PD2
  • RXD - PD0
  • G3 - PD1

USB:

  • TXD - PD6
  • RXD - PD5

docs

Reference manual: http://www.st.com/web/en/resource/technical/document/reference_manual/CD00190271.pdf

CPU reference: http://www.st.com/web/en/resource/technical/document/programming_manual/CD00161709.pdf

Product Datasheet: http://www.st.com/web/en/resource/technical/document/datasheet/DM00024550.pdf

Errata: http://postar.sino-star.com/public/uploads/20120214161049_871.pdf

CH340G

Datasheet: http://www.seeedstudio.com/wiki/images/7/7c/CH340DS1_EN.PDF

tools

https://github.com/vdudouyt/stm8flash

brew install sdcc

http://www.colecovision.eu/stm8/128-EVAL%20Dhrystone.shtml

how it works

interrupts are priority-based outputs in 64 byte packets. priority output is real time input of "uniterruptable streams", specifically i2c read (max 920Khz) and uart input (max 18400bps) simultaneously

also note that i2c can stretch clock lines so really it's only uart interrupts

there are many buffers, but this one is mine(d) for its outputting content. all packets block on new input until it's swapped for the outputting. so buffers must clean faster than they collectively are filled for uninterruptable streams (and acks).

output from radius is asap and dumped into its buffers. simple packet id + NACK/ACK acknowledgement byte on the usb line.

ID0 + NACK/ACK ID1 + LEN + <=64 byte packet

input? it is 64 byte packets. wait for an nack, then resend, or continue

LEN + <=64 byte packet

input is synced at start by waiting for an 'R' on both sides

packets are USB-style repeated until a 0 length packet or < 64 length packet is received

license

MIT/ASL2

About

A cheap (in quality) and cheap (in dollars) USB comms adapter: 10 pins of SPI/I2C/UART/GPIO.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published