developer.shyd.de. studying my hobby

8Sep/1337

AVR, Raspberry Pi, VW Beta: VAG CDC Faker

(4 votes, average: 5.00 out of 5)
Loading...

I was tired connecting my cellphone with an old cassette adapter to my VW Golf with an Beta 5 in it. I needed something new, something cool. And here it is, a fully functional interface between the Beta 5 and any device you want to play the music with.

This project raised out of an ebay search: I just wanted to know if there is a solution to get an AUX input on the car radio. Yes there is, even complete mp3 players are available. But that's not what I wanted - at first!

Then I started digging the web for more info about the protocol the radio talks to cd changers.
The idea was to build a tiny thingy that fakes a cd changer and simply enables the AUX input (as it is available in several online stores). But during the development my ambition became greater and I wanted to read the keys pressed on the radio to remote control my RPi.

1. Understanding the Protocol

First of all this is the pinout of the radio: rkieslinger.de/steckerbelegungen/vag-stecker.htm
The interesting cell is no. 3, the blue one.
DATA IN simply is MOSI of an 8bit SPI interface with special timings between the bytes
CLOCK is SCK of the SPI
DATA OUT is the key code of the pressed key on the radio itself

The radio needs a sequence of bytes to enable the AUX input and display CD# and TR#. It looks likes this:

frame cd#   tr#   time  time  mode  frame frame
0x34, 0xBE, 0xFF, 0xFF, 0xFF, 0xFF, 0xCF, 0x3C

cd# and tr# are sent inverted. So this sequence will display: CD1 TR00
mode sets the playmode (PLAY|SHFFL|SCAN)

7Jun/131

FTDI: interfacing FT1248/FT220x over SPI

(2 votes, average: 4.50 out of 5)
Loading...

In my current project I want to interface the FT220x over 1-bit SPI with an TI piccolo TMS320F28027.
After some trouble and various cups of coffee I managed the whole thing by implementing the SPI in pure software.

I wasn't able to get it working with the built in tri-wire hardware SPI as the FT uses MIOSIO and MISO to send/receive data and status respectively.

Because there is no sample code available on the web concerning this problem I decided to publish my library here. Take a look into the datasheet for further information!

Sending data over SPI to the FT1248/FT220x is quite easy: Just send a WRITE_REQ (0x00) followed by the payload on MIOSIO.

Reading is a bit more complicated: We need to know how many chars to read. Well, send a READ_REQ (0x02), evaluate MISO and read data on MIOSIO if the FIFO is not empty.

Filed under: C/C++, Hardware, Microcontroller, Software | 5,389 views Continue reading