CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

DSPIC33 GPS WITH UART DMA

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
georpo



Joined: 18 Nov 2008
Posts: 281
Location: Athens, Greece.

View user's profile Send private message

DSPIC33 GPS WITH UART DMA
PostPosted: Sun Jul 28, 2013 6:04 am     Reply with quote

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.
bkamen



Joined: 07 Jan 2004
Posts: 1615
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Tue Jul 30, 2013 7:32 pm     Reply with quote

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
temtronic



Joined: 01 Jul 2010
Posts: 9226
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Jul 31, 2013 5:26 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group