software serial ports

15 views
Skip to first unread message

William Premerlani

unread,
Nov 17, 2011, 5:19:15 PM11/17/11
to uavdevb...@googlegroups.com
Team,
All the versions of the UDB have two serial ports, one for the GPS, and one for anything else, such as OpenLog.
From time to time there have been requests from UDB users for more than two serial ports.
If we wanted to provide more than two serial ports, we could do that with the existing hardware by implementing it in software. It really would not be that hard to do, we could even use interrupts to reduce the CPU loading required to do it.

So, I have two questions:

1. Do you think we should offer an optional third "software" serial port?

2. If so, do we have any volunteers to do it? I would be happy to help out.

Best regards,
Bill

ben levitt

unread,
Nov 17, 2011, 5:30:09 PM11/17/11
to uavdevb...@googlegroups.com
This could be very useful for integrating with external devices.  Some sensors, OSDs, etc...  I'd be interested in this too, but not sure if I'll have time to build it right now...

Ben

Tom Pittenger

unread,
Nov 30, 2011, 11:35:23 PM11/30/11
to uavdevb...@googlegroups.com
Ben & Bill,

There was a really nifty trick I saw with the PIC32 but I don't know if it will work with a dsPIC33. Microchip had a somewhat working-ish example but they have since dropped any mention of it including the link to download it. Anyhow, maybe this will give someone an idea on how to do it if/when someone does for the dsPIC.

The trick is the PIC32 IO pins are memory mapped and the DMA was capable of writing to any memory mapped location so:

1) set desired PORTA (or whatever) pins as outputs
2) load 16bit array with an array 10 indexes deep (start + 8 bits + stop). array[0].bit0 = start bit, array[1].bit0 = MSB, array[8].bit0 = LSB, array[9].bit0 = stop bit.
3) Set DMA start pointer to the array (RAM), length = 10, and "copy" it to the physical destination port address of PORTA
4) Set a general purpose timer to 115200 (or whatever) and have it trigger the DMA transfer at that interval effectively placing the 16 bits of the array onto the port in parallel. BAM, you have a parallel transfer at a given baud rate.
5) Configure IRQ for DMA transfer done.

If there are two DMA controllers, you have up to 32 output UARTs. It wouldn't be called a UART, more like UAT.

Inputs are possible but hard to get the start bit timing smooth.


Hope this helps someone!

-TomP

Nikolay Arsov

unread,
Dec 14, 2011, 11:22:15 AM12/14/11
to uavdevb...@googlegroups.com
Tom,
The problem is that dsPIC33FJ256GP710 has no remappable ports.
There are two approaches - one is software -  Bill's idea. Any of the SPI or I2C ports could be used for. No hardware changes.
The other is hardware - to change the MCU with one with remappable capabilities...say dsPIC33EPxxxMUxxx. Maybe there will be some software changes which would be uncomfortable.

Best regards
Nick

crashmatt

unread,
Dec 18, 2011, 5:48:03 PM12/18/11
to uavdevboard-dev
Hi,

I have an alternative suggestion. Use a hardware UART with SPI (or
I2C) interface:

This one is true RS232 output which may not be what you want
http://www.maxim-ic.com/datasheet/index.mvp/id/2052

This is a quad UART with inbuilt FIFOs, fractional clock PLL, max
6Mbaud data rate etc...
http://www.maxim-ic.com/datasheet/index.mvp/id/6560

or the single version if that is overkill
http://www.maxim-ic.com/datasheet/index.mvp/id/6560

Regards Matt

Reply all
Reply to author
Forward
0 new messages