View previous topic :: View next topic |
Author |
Message |
georpo
Joined: 18 Nov 2008 Posts: 278 Location: Athens, Greece.
|
DSPIC33 GPS WITH UART DMA |
Posted: Sun Jul 28, 2013 6:04 am |
|
|
Hello everybody.
I am facing this problem:
I have a gps that sends ascii strings through UART.
The length of the string is 78-140 bytes depending on the information included and is terminated with line feed character.
If I try to receive the characters byte by byte until I receive the line feed, I get UART interrupts every ~26uS for every character received. (The baud rate is 38400).
The messages repeat every 200mS. In general I would say that this is a bad approach because it keeps my PIC busy.
On the other hand, I used DMA to have the characters stored in a long string automatically
and then get an interrupt when the string reaches the length that I want.
This works great BUT the string length from the GPS is never the same so I can not set the DMA to interrupt correctly.
I do not know if there is a way to set DMA interrupt when it receives a specific character or something like that.
Thanks! _________________ George. |
|
![](templates/subSilver/images/spacer.gif) |
bkamen
Joined: 07 Jan 2004 Posts: 1611 Location: Central Illinois, USA
|
|
Posted: Tue Jul 30, 2013 7:32 pm |
|
|
26uS @ 38400bps?
Erm... you might wanna check your math first?
Also, check to make sure the UART doesn't buffer more than one char.
As I'm looking at the family datasheet, the dsPIC looks to buffer 4 chars before setting an IRQ (if you set it up that way)
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9173 Location: Greensville,Ontario
|
|
Posted: Wed Jul 31, 2013 5:26 am |
|
|
from your post....
I have a gps that sends ascii strings through UART.
The length of the string is 78-140 bytes depending on the information included and is terminated with line feed character.
...
so I'd setup a circular buffer, read in everything and exit when I read in the line feed character (0x10), save the data into another 'working' variable, then clear the circular buffer.
Ther's several examples of this, search for 'parsing SMS' or some similar wording.
hth
jay |
|
![](templates/subSilver/images/spacer.gif) |
|