2009-03-10 04:05:37     UART-over-SPI

Document created by Aaronwu Employee on Aug 14, 2013
Version 1Show Document
  • View in full screen mode

2009-03-10 04:05:37     UART-over-SPI

Sergey Kuznetsov (RUSSIAN FEDERATION)

Message: 70656   

 

Hi all!

 

Recently, I faced the need of emulation of uart over spi in BF537 stamp board. Firstly, I tried to find a similar one but failed. Have you ever seen such a driver? Search over the internet gave me nothing.

 

Thank ypu!

QuoteReplyEditDelete

 

 

2009-03-10 04:08:35     Re: UART-over-SPI

Mike Frysinger (UNITED STATES)

Message: 70657   

 

umm, what exactly do you mean ?  you want to talk to a RS232 module over SPI ?  or you want to take the wires straight out of the Blackfin and connect them to a serial cable ?

QuoteReplyEditDelete

 

 

2009-03-10 04:18:04     Re: UART-over-SPI

Sergey Kuznetsov (RUSSIAN FEDERATION)

Message: 70667   

 

hm, i wasn`t clear enough... I`ve got a link BF537(spi) -> (spi)device1 -> (spi)device2 -> (spi)BF537. Devices are CC1101, ChipCon transceivers. All I want is to make BF537 think it uses UART instade of spi, like this : BF537(UART)|(spi) -> (spi)device1 -> (spi)device2 -> (spi)|(UART)BF537. So I mean to write a UART driver, that uses SPI layer.I understand, that UART drivers, which use SPI are rare(if exist), instaed of SLIP, PLIP, etc., but tried to find existing one...

QuoteReplyEditDelete

 

 

2009-03-10 04:24:58     UART-over-SPI

Michael Hennerich (GERMANY)

Message: 70668    There is a UART driver that is emulated by an SPORT Serial peripheral.

I don't think it's that easy to do it with a SPI Peripheral.

 

There is always the option to use external UARTs connected to the async.

Memory interface (EBIU).

 

-Michael

 

QuoteReplyEditDelete

 

 

2009-03-10 04:26:10     Re: UART-over-SPI

Mike Frysinger (UNITED STATES)

Message: 70670   

 

you want to emulate a SPI bus using the UART peripheral ?

QuoteReplyEditDelete

 

 

2009-03-10 04:33:42     Re: UART-over-SPI

Sergey Kuznetsov (RUSSIAN FEDERATION)

Message: 70671   

 

May be I did not fully understand it, but UART_SPORT driver emulates UART`s signals on SPORT, isn`t it? All I want to try, is to, for example, open console, send a byte, which will be sent over SPI, and on the other end received on SPI, used by UART_SPI driver and put on a console. I don`t have to emulate UART levels, signals and other stuff on SPI port.

 

Do you think it`s hard to make?

 

Thnak you,

 

Sergey

QuoteReplyEditDelete

 

 

2009-03-10 04:39:49     Re: UART-over-SPI

Mike Frysinger (UNITED STATES)

Message: 70672   

 

usually when people talk about "UART-over-SPI", they are talking about things at the signal level, not at a higher software level

 

i think you actually want to create a tty device that reads/writes bytes on a specific chip select.  if you dont actually want a console but rather just a simple communication channel, then use spidev:

http://docs.blackfin.uclinux.org/doku.php?id=spi

 

then you can simply do:

echo moo cow > /dev/spidev0.3

QuoteReplyEditDelete

 

 

2009-03-10 04:40:39     Re: UART-over-SPI

Sergey Kuznetsov (RUSSIAN FEDERATION)

Message: 70673   

 

No, not really, I want to send data, put in an interface ttyS0(for example), via SPI. That means ttyS0 should use special driver, which allow to send data from console(for example) over SPI bus.

QuoteReplyEditDelete

 

 

2009-03-10 04:54:09     Re: UART-over-SPI

Sergey Kuznetsov (RUSSIAN FEDERATION)

Message: 70675   

 

Hm. didn`t know it...

 

You see, I really should have a specific driver, because, in general, I should make a PPP over it....The other problem is that there are 8 SPI devices, working in parallel. I have to make them act as one UART for the BF537. If I make it, I can use a PPP to send/receive data from higher levels. So for the PPP it should be a simple UART. In this case, driver should have SPI as a transport level and be a UART device for linux.

 

Thank you,

 

Sergey

QuoteReplyEditDelete

 

 

2009-03-10 05:04:22     Re: UART-over-SPI

Mike Frysinger (UNITED STATES)

Message: 70677   

 

i think you're confusing UARTs and TTYs.  i'm pretty sure what you actually want is a TTY driver that uses SPI functions in the background for transmission.

 

it shouldnt be terribly hard to implement that.  just look at the bfin_jtag_comm.c driver as that is pretty lean (less than 400 lines) and includes console support.

 

otherwise you can file a tracker and we'll look at it for our next release.

QuoteReplyEditDelete

 

 

2009-03-10 05:14:17     Re: UART-over-SPI

Sergey Kuznetsov (RUSSIAN FEDERATION)

Message: 70678   

 

To be more clear:

 

I have to transport TCP/IP over the link BF -(spi)- device1-(radio)-device2-(spi)-BF. There are several ways to make it:

 

1. make eth driver over spi

 

2. make slip driver over spi

 

3. make UART driver over spi, and other stuff will make ppp, slip, etc...

 

The easiest way for me is 3.

 

This is how it should be: any data, received by UART device (from PPP for example) with UART-SPI driver (let me call it this way), should be transported over SPI phisical bus. UART-SPI driver gets uart data, makes some magic and control, and puts it in spi. That SPI data is put on CC1101, then on the air, and received the same way. I thought, that if there is a plip driver, may be there could be uart driver, using spi transport... 

QuoteReplyEditDelete

 

 

2009-03-10 05:18:58     Re: UART-over-SPI

Sergey Kuznetsov (RUSSIAN FEDERATION)

Message: 70679   

 

I feel you are absolutely right!

 

I`m going to read it! Thank you!

Attachments

    Outcomes