Trying to log data from UM6 sensor with GPS receiver LS20031. I have two problems: - I can't log to file at a fast rate (<0.5s) without data values freezing to a fixed value. Print to pc screen it works fine. Ideally I would do this with an interrupt (e.g. ticker) so that the time of each reading is a fixed interval - I removed this as I thought this was causing the problem. - I want to record GPS lat and long. I have setup the GPS ground speed so I know the sensor are communicating. So I possibly havent set the config file to correctly interpet these two signals.

Dependencies:   MODSERIAL mbed

Fork of UM6_IMU_AHRS_2012 by lhiggs CSUM

Committer:
lhiggs
Date:
Fri Sep 28 00:40:29 2012 +0000
Revision:
0:03c649c76388
Child:
1:20201cda90d0
A UM6 IMU AHRS INTERFACE

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lhiggs 0:03c649c76388 1 #include "mbed.h" // MBED LIBRARY
lhiggs 0:03c649c76388 2 #include "MODSERIAL.h" // MBED BUFFERED SERIAL
lhiggs 0:03c649c76388 3
lhiggs 0:03c649c76388 4 #include "UM6_usart.h" // UM6 USART HEADER
lhiggs 0:03c649c76388 5 #include "UM6_config.h" // UM6 CONFIG HEADER
lhiggs 0:03c649c76388 6
lhiggs 0:03c649c76388 7 /////////////////////////////////////////////////////////////////////////////////////////////
lhiggs 0:03c649c76388 8 // SETUP (ASSIGN) SERIAL COMMUNICATION PINS ON MBED
lhiggs 0:03c649c76388 9 /////////////////////////////////////////////////////////////////////////////////////////////
lhiggs 0:03c649c76388 10 MODSERIAL pc(USBTX, USBRX); // PC SERIAL OVER USB PORT ON MBED
lhiggs 0:03c649c76388 11
lhiggs 0:03c649c76388 12 ////////////////////////////////////////////////////////////////////////////////////////////////
lhiggs 0:03c649c76388 13 // SETUP (ASSIGN) MBED LED (1 thru 3) FOR VISUAL DEBUGGING ON MBED
lhiggs 0:03c649c76388 14 ////////////////////////////////////////////////////////////////////////////////////////////////
lhiggs 0:03c649c76388 15 DigitalOut pc_activity(LED1); // LED1 = PC SERIAL
lhiggs 0:03c649c76388 16 DigitalOut uart_activity(LED2); // LED2 = UM6 SERIAL
lhiggs 0:03c649c76388 17
lhiggs 0:03c649c76388 18
lhiggs 0:03c649c76388 19 void rxCallback(MODSERIAL_IRQ_INFO *q) {
lhiggs 0:03c649c76388 20 if (um6_uart.rxBufferGetCount() >= MAX_PACKET_DATA) {
lhiggs 0:03c649c76388 21 uart_activity = !uart_activity; // Lights LED when uart RxBuff has > 40 bytes
lhiggs 0:03c649c76388 22 Process_um6_packet();
lhiggs 0:03c649c76388 23 }
lhiggs 0:03c649c76388 24 }
lhiggs 0:03c649c76388 25
lhiggs 0:03c649c76388 26
lhiggs 0:03c649c76388 27 int main() {
lhiggs 0:03c649c76388 28
lhiggs 0:03c649c76388 29 /////////////////////////////////////////////////////////////////////////////////////////////////////
lhiggs 0:03c649c76388 30 // SET SERIAL UART BAUD RATES
lhiggs 0:03c649c76388 31 /////////////////////////////////////////////////////////////////////////////////////////////////////
lhiggs 0:03c649c76388 32
lhiggs 0:03c649c76388 33 // set UM6 serial uart baud 9600
lhiggs 0:03c649c76388 34 um6_uart.baud(9600);
lhiggs 0:03c649c76388 35 pc.baud(9600); // pc baud for UM6 to pc interface
lhiggs 0:03c649c76388 36
lhiggs 0:03c649c76388 37 // attach interupt function to uart
lhiggs 0:03c649c76388 38 um6_uart.attach(&rxCallback, MODSERIAL::RxIrq);
lhiggs 0:03c649c76388 39
lhiggs 0:03c649c76388 40 int Roll_Counter = 0;
lhiggs 0:03c649c76388 41
lhiggs 0:03c649c76388 42 while (1) {
lhiggs 0:03c649c76388 43 Roll_Counter++;
lhiggs 0:03c649c76388 44 if (Roll_Counter > 5000000) {
lhiggs 0:03c649c76388 45 pc.printf("Gyro_Proc_X %f deg/s, ",data.Gyro_Proc_X);
lhiggs 0:03c649c76388 46 pc.printf("Gyro_Proc_Y %f deg/s, ",data.Gyro_Proc_Y);
lhiggs 0:03c649c76388 47 pc.printf("Gyro_Proc_Z %f deg/s, ",data.Gyro_Proc_Z);
lhiggs 0:03c649c76388 48 pc.printf("Roll %f deg, ",data.Roll);
lhiggs 0:03c649c76388 49 pc.printf("Pitch %f deg, ",data.Pitch);
lhiggs 0:03c649c76388 50 pc.printf("Yaw %f deg \r\n",data.Yaw);
lhiggs 0:03c649c76388 51 pc_activity = !pc_activity; // Lights LED when uart RxBuff has > 40 bytes
lhiggs 0:03c649c76388 52 Roll_Counter = 0;
lhiggs 0:03c649c76388 53 }
lhiggs 0:03c649c76388 54
lhiggs 0:03c649c76388 55 } // end while(1) loop
lhiggs 0:03c649c76388 56
lhiggs 0:03c649c76388 57 } // end main()