PIC/AVR serial modes

Are there other serial modes on PIC/AVR than standard RS-232 and SPI ..?

Especially is there any USART mode where one can send a string of bits longer than 10 bits without start/stop bits inbetween. Just like an ethernet frame or such?

Reply to
valwn
Loading thread data ...

You can do whatever you like if you implement it yourself in software.

Leon

Reply to
Leon

Sure, but the idea was to use a builtin hardware USART to reduce the cpu load.

Reply to
valwn

.?

longer

frame

load.

Reply to
lewin.a.edwards

.?

longer

frame

load.

If you use a part that has an SPI interface with DMA, that will (kinda) give you what you want.

Reply to
lewin.a.edwards

Some of the newer AVRs has a synchronous serial mode for the UART. One can program 5 bits per character mode, and send 2 in synchronous mode. Regards Anton Erasmus

Reply to
Anton Erasmus

longer

frame

You can send any string of bits using the SPI interface.

Meindert

Reply to
Meindert Sprang

That work for open collector or RS485 bus too..?

Reply to
valwn

..?

Of course. The SPI output is just a serial output, just like the UART TX output. You can add anything to that port, an open collector stage, a MAX485, anything.

Meindert

Reply to
Meindert Sprang

SPI has three signal lines. My bus is only 1-bit "wide" (open collector). So somehow clock + data must be joined.

Reply to
valwn

If you want to encode clock information in your data stream you have to do it before writing it to the SPI register. SPI is basically a parallel in serial out register on the transmit side, and a serial in parallel out register on the receive side. If you keep loading 0x55 into the SPI DATA register you will get a clock signal of 1/2 the SPI clock on the MOSI pin. Keep loading 0x0F, and you will get a clock at 1/8 of the SPI clock on the MOSI pin.

Regards Anton Erasmus

Reply to
Anton Erasmus

IIRC you wanted to create a serial signal without the boundaries of start and stopbits or a predefined word length. For that, you only need the SPI output (MOSI). You don't need to join clock and data. Or it must be that you want to do something more than you asked us...

Meindert

Reply to
Meindert Sprang

Now that's an idea. However there will be a problem to recover the clock on the receiving side.

Reply to
valwn

If you use something like manchester encoding on your trasnmit side, you are guaranteed an edge at least every second bit. On your Rx side you can use a Phased Locked Loop to align a local clock with your data stream clock.

Regards Anton Erasmus

Reply to
Anton Erasmus

Can this PLL be accomplished without external components ..?

Reply to
valwn

Depends on your data rate. In principle it is possible. You may also be able to decode using an edge triggerred interrupt on a GPIO pin. A negative edge is a 0 and a positive edge is a 1.

Regards Anton Erasmus

Reply to
Anton Erasmus

What? By definition, Manchester encoding has an edge *every* bit at the centerpoint, where the direction of the edge indicates the data bit being encoded.

Reply to
larwe

I prefer the variant where there is a transition at the start of every bit and another transition in the center if the bit is a 1. I think it is called 'Biphase-S' (of FM). It has the benefit that it is insensitive to the polarity of the signal and very easy to sync to the start of a bit.

What Anton may have been referring to is MFM as used on disk controllers.

formatting link

Reply to
Rocky

You are correct. I meant compared to the original clock, the manchester data stream has an positive edge at least every second clock period.

Regards Anton Erasmus

Reply to
Anton Erasmus

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.