Curently i have a setup of this
SD1 = GSM modom
SD2 = GPS Receiver
#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
#define SERIAL_BUFFERS_SIZE 512
#endif
/*
* SERIAL driver system settings.
*/
#define STM32_SERIAL_USE_USART1 TRUE
#define STM32_SERIAL_USE_USART2 TRUE//FALSE
#define STM32_SERIAL_USE_USART3 FALSE
#define STM32_SERIAL_USART1_PRIORITY 7//12
#define STM32_SERIAL_USART2_PRIORITY 7//12
#define STM32_SERIAL_USART3_PRIORITY 12
But still i hit buffer overrun with GPS.
GPS will be sending, NMEA strings 4/5 of them every second.......
Fighting against Buffer Overruns
Moderators: RoccoMarco, lbednarz, tfAteba
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: Fighting against Buffer Overruns
GPS is @ 9600 Baud
GSM is at 115200, but the comms to it are small (AT commands) and sporadic
also here is my receiving thread for ref.
GSM is at 115200, but the comms to it are small (AT commands) and sporadic
also here is my receiving thread for ref.
Code: Select all
static THD_FUNCTION(ThreadGPS, arg)
{
msg_t c;
eventflags_t flags;
event_listener_t elGPSdata;
(void)arg;
chRegSetThreadName("gpsd");
chEvtRegisterMask(chnGetEventSource(&SD2),
&elGPSdata,
EVENT_MASK(1));
while( TRUE )
{
flags = chEvtGetAndClearFlags(&elGPSdata);
if(flags & SD_OVERRUN_ERROR)
{
TGL_DEBUG(DBG_MASK_GPS, "Overrun GPS !\r\n"); // keep hitting this !!!!
}
if(flags & CHN_INPUT_AVAILABLE)
{
do
{
c = chnGetTimeout(&SD2, TIME_IMMEDIATE);
if ( c != Q_TIMEOUT )
{
decodeNMEAstateMachine( (char)c );
}
}
while (c != Q_TIMEOUT);
}
chEvtWaitOneTimeout(EVENT_MASK(1), MS2ST(10));
}
}
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: Fighting against Buffer Overruns
hi,
The overflow can be caused by two possible problems:
1) When the driver is not able to serve USART interrupts quickly enough so there is an HW overflow condition.
2) When the application is not able to empty the queue fast enough, the ISR is not able to write in the queue the received byte. This can mitigated by increasing the queue size in halconf.h.
By placing breakpoints in the driver ISR you could try to understand what kind of overflow you are getting.
Giovanni
The overflow can be caused by two possible problems:
1) When the driver is not able to serve USART interrupts quickly enough so there is an HW overflow condition.
2) When the application is not able to empty the queue fast enough, the ISR is not able to write in the queue the received byte. This can mitigated by increasing the queue size in halconf.h.
By placing breakpoints in the driver ISR you could try to understand what kind of overflow you are getting.
Giovanni
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: Fighting against Buffer Overruns
Note that there is a discussion ongoing about use of the UART driver (with DMA) in this specific scenario: viewtopic.php?f=25&t=3441
Giovanni
Giovanni
Re: Fighting against Buffer Overruns
Giovanni wrote:Note that there is a discussion ongoing about use of the UART driver (with DMA) in this specific scenario: viewtopic.php?f=25&t=3441
Giovanni
Think this is a different propersition to me, as there baud rates are very high, i'm only at 9600 so i should not really been having issues.
I'll have alook at the Interrupts and see what i can dig up.