SerialBuffered Issue

03 Mar 2011

I have recently been trying to use SerialBuffered to buffer an incoming GPS stream. Whilst the buffering seemingly worked, my program also used a ticker which set a flag every 10ms causing a method to be called. My problem is that the SerialBuffered library never seems to relinquish the interrupt and the ticker never ticks. A change to using the MODSERIAL library for buffering instantly made my code work.

Cheers, Rob

03 Mar 2011

Rob,

Thanks the vote on MODSERIAL :) You maybe interested to know I also have a MODGPS library that handles GPS for you :) :-

Import libraryMODGPS

Allows for a GPS module to be connected to a serial port and exposes an easy to use API to get the GPS data. New feature, added Mbed/LPC17xx RTC synchronisation

03 Mar 2011

Cheers Andy, I did see the MODGPS, but I ended up writing my own code as it had to be quite exact and efficient to pull exactly what I wanted out of 2 GPS sentences coming in at 10Hz. Currently my project is an Inertial System + GPS + Baro data logger. Eventually it will be a fully integrated Aided-INS once I have done the filter design in Simulink.

03 Mar 2011

Rob, sounds like a cool project! When your ready will you be posting any notes or write up on it? It's always nice to see where libraries end up :) One other thing, MODSERIAL has a feature where you can make it callback from the ISR when to detect a specific char (see the end of the MODSERIAL cookbook page) that allows the buffer to fill with the stream and notify you when a "packet" has been completely read. Or did you use another technique? I was just looking for feedback as it's always great to hear how it's been used and if there's anyway I can improve on a library and make more useful.

03 Mar 2011

Thanks for the interest Andy. The project is my final work for my undergraduate masters in electronics. I may well post up the project afterwards, but technically the University owns all rights, so I'm not sure if it's quite as simple as that.

I saw the callback function using to wait for a certain character, however I feel that as the function is just checking the last character anyway, I may as well just call getc() and check for myself. Perhaps using your method would be slightly more efficient, but the margin is acceptable for me and my code was initially written without that in mind.

My main performance bottleneck currently is the SD Card which burst writes and whilst most of my acquisition cycles take 4000 us, every 4 seconds one cycle takes 20000 us or more. Unfortunately fflush() doesn't seem to force a write, and therefore this is causing my logger to lose cycles occasionally. I was actually looking at your MODDMA earlier to see if I can use that to improve things, however without a knowledge of the FATFileSystem and file i/o commands, I don't think it is as easy to implement as I would hope.

03 Mar 2011

I actually used the GPDMA (which lead to the generic MODDMA library) that manages a local 16M flash device. Worked a treat. The SPI bus that the flash device was connected to also hosts an SD Card slot (I use a SSP class to "share" the bus amoungst devices). However, I never got around to rewiting diskio.c to make use of GPDMA. But in fact it would be fairly simple to do.

http://mbed.org/users/AjK/programs/SOWB/lg489e/docs/flash__write_8c_source.html

http://mbed.org/users/AjK/programs/SOWB/lg489e/docs/diskio_8c_source.html