11 years, 5 months ago.

mbed Implementation of SPI(Master) To UART Conversion

Does anybody fried to implement a SPI Master to UART conversion using mbed? Is it possible? Most of the SPI-to-UART converter out there are either SPI Mode 1 and/or SPI Slave. I would like to have allow for the SPI to interface with a Analog device ADIS16480 IMU.

Didn't try it myself, but no reason why it shouldn't be possible. Should actually be pretty straightforward.

posted by Erik - 07 Jul 2013

UART communication is typically 8-bit at a time, the SPI communication is 16 bit at a time. You need some kind of synchronisation mechanism or a protocol in order to combine the correct UART bytes into an SPI word. Alternatively you can define a higher level protocol that allows to work with real data rather than raw registers.e.g. something similar to NMEA sentences

posted by Ad van der Weiden 08 Jul 2013

3 Answers

11 years, 5 months ago.

Have you checked the price?

Mouser - http://www.digikey.com/product-detail/en/ADIS16480AMLZ/ADIS16480AMLZ-ND/3467725

$2,241.47

Newark - http://www.newark.com/analog-devices/adis16480-pcbz/adis16480-pcb-eval-bd-pb-free/dp/94T9410

$3,348.16

Hiring someone to write the code for you might be easiest.

11 years, 5 months ago.

The mbed handbook is a good place to start. Take a look at the APIs for SPI Master and UART:

http://mbed.org/handbook/SPI

http://mbed.org/handbook/Serial

If the mbed is dedicated to SPI-to-UART, you can have a loop running forever that reads from SPI and sends the data over UART. (Or vice versa, in that case, take a look at Serial::readable())

-Kevin

11 years, 5 months ago.

Yes you can do it with a €50 mbed, you can also do it with a €1,20 ATtiny2313, or a €3,50 ATMega328 (the Arduino chip). Even a complete Arduino Uno is cheaper than the Mbed and for this simple task will do just as well. What else do you need to do?