Commit 5e867565 authored by Theodor-Adrian Stana's avatar Theodor-Adrian Stana

Debugging in progress on GPS optimization

parent 2b4e9a38
......@@ -65,7 +65,7 @@ void LEUART0_IRQHandler()
rxbuf[idx] = '\0';
idx = 0;
gps_set_framerdy(1);
// gps_parse_nmea(rxbuf);
gps_parse_nmea(rxbuf);
}
}
}
......@@ -160,7 +160,7 @@ void gps_parse_nmea(const char *buf)
{
// TODO: check return of nmea_parse
nmea_parse(&parser, buf, strlen(buf), &info);
dbg();
// dbg();
usbdbg_puts(buf);
}
......
......@@ -105,7 +105,7 @@ override ASMFLAGS += -x assembler-with-cpp -D$(DEVICE) -Wall -Wextra -mcpu=corte
# NOTE: The -Wl,--gc-sections flag may interfere with debugging using gdb.
#
override LDFLAGS += -Xlinker -Map=$(LST_DIR)/$(PROJECTNAME).map -mcpu=cortex-m3 \
-mthumb -T../common/Device/EnergyMicro/EFM32GG/Source/GCC/efm32gg_bootld.ld \
-mthumb -T../common/Device/EnergyMicro/EFM32GG/Source/GCC/efm32gg.ld \
-Wl,--gc-sections
LIBS = -Wl,--start-group -lgcc -lc -lnosys -Wl,--end-group
......@@ -272,7 +272,7 @@ ifeq ($(filter $(MAKECMDGOALS),all debug release),)
endif
flash: $(EXE_DIR)/$(PROJECTNAME).bin
openocd -s ../common/openocd -f interface/$(OOCD_IFACE).cfg -f init.cfg -c "program $(EXE_DIR)/$(PROJECTNAME).bin 0 verify reset 0x8000"
openocd -s ../common/openocd -f interface/$(OOCD_IFACE).cfg -f init.cfg -c "program $(EXE_DIR)/$(PROJECTNAME).bin 0 verify reset"
# include auto-generated dependency files (explicit rules)
ifneq (clean,$(findstring clean, $(MAKECMDGOALS)))
......
......@@ -45,7 +45,7 @@ void debug();
///> Prioriuty of application task
#define APP_PRIORITY (tskIDLE_PRIORITY + 1)
#define BKGRND_APP_PRIORITY (tskIDLE_PRIORITY + 2)
#define BKGND_APP_PRIORITY (tskIDLE_PRIORITY + 2)
///> Shared application task handle
......
......@@ -39,8 +39,9 @@ void gpsbkgrnd_main(void *params)
(void) params;
while (1) {
if (xSemaphoreTake(semGps, portMAX_DELAY)) {
if (xSemaphoreTake(semGps, portMAX_DELAY) == pdTRUE) {
gps_parse_nmea(gps_rxbuf);
gps_set_framerdy(0);
}
}
}
......
......@@ -113,19 +113,34 @@ void HardFault_Handler(void)
char gps_rxbuf[GPS_RXBUF_SIZE];
static volatile int idx = 0;
static volatile int store = 0;
extern xSemaphoreHandle semGps;
void LEUART0_IRQHandler(void)
{
char c;
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
if (LEUART0->IF & LEUART_IF_RXDATAV) {
gps_rxbuf[idx++] = LEUART_Rx(LEUART0);
if ((gps_rxbuf[idx-2] == '\r') && (gps_rxbuf[idx-1] == '\n')) {
gps_rxbuf[idx] = '\0';
idx = 0;
xSemaphoreGiveFromISR(semGps, &xHigherPriorityTaskWoken);
c = LEUART_Rx(LEUART0);
/* Start storing on frame start char and if app allows it */
if ((c == '$') && !gps_get_framerdy())
store = 1;
if (store) {
gps_rxbuf[idx++] = c;
/* Signal task that frame is ready */
if ((idx > 2) &&
(gps_rxbuf[idx-2] == '\r') && (gps_rxbuf[idx-1] == '\n')) {
gps_rxbuf[idx] = '\0';
idx = 0;
store = 0;
gps_set_framerdy(1);
xSemaphoreGiveFromISR(semGps, &xHigherPriorityTaskWoken);
}
}
}
......
......@@ -52,6 +52,8 @@ int main(void)
rtc_init();
lcd_init();
ui_init();
vSemaphoreCreateBinary(semGps);
gps_init();
GPIO_PinModeSet(gpioPortE, 11, gpioModePushPull, 0);
......@@ -66,10 +68,9 @@ int main(void)
startMain(&menu);
vSemaphoreCreateBinary(semGps);
/* Create background task for GPS */
if (xTaskCreate(gpsbkgrnd.main, (const signed char *)gpsbkgrnd.name,
APP_STACK_SIZE, NULL, APP_PRIORITY, NULL) != pdPASS) {
APP_STACK_SIZE, NULL, BKGND_APP_PRIORITY, NULL) != pdPASS) {
// TODO oops..
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment