Hello
I have Crius GPS and FC AIOP and I've made the nice modification by soldering on the GPS the pins 13&14 together
This is working like a charm. Starting from default 38400baud and setting 115400baud/10hz from the MW 2.1 software modified. So no more problem due to the lack of power for the battery not working so well
Here the piece of code to modifiy in Multiwii_2_1.ino. This is a little "harded" coded by using Serial2 from "HardwareSerial" component since I've connected my GPS on the serial #2 port. The code here after is the full section to init the GPS_SERIAL
In order to have your sktech compiling with Arduino 1.0.1, you will need to comment some part of code in HardwareSerial.cpp. I think it is necessary since those macro are probably alredy defined somewhere in the mwc sketech
hardwareSerial.cpp is located in "arduino-1.0.1\hardware\arduino\cores\arduino"
Then you can flash this version on your CRIUS AIOP FC and your CRIUS GPS should be fine now
hope that will help folk!
-------------------------------------------- modifcations in multiwii_2_1 -----------------------------------------------
Code: Select all
#if defined(GPS_SERIAL)
[COLOR="Red"] /*****
//debut suppression BR
SerialOpen(GPS_SERIAL,GPS_BAUD);
delay(400);
//fin suppression BR
******/[/COLOR]
[COLOR="DarkGreen"] //debut ajout BR
//ouverture de la connexion en 38400 baud
//programmation par trames UBX du GPS en 115200 baud et 10hz
//puis reouverture de la connexion en 115200
delay(1000);
Serial2.begin(38400);
delay(500);
byte gps10hz[] = {0xB5,0x62,0x06,0x08,0x06,0x00,0x64,0x00,0x01,0x00,0x01,0x00,0x7A,0x12};
Serial2.write(gps10hz,sizeof(gps10hz));
/****
byte gps5hz[] = {0xB5,0x62,0x06,0x08,0x06,0x00,0xC8,0x00,0x01,0x00,0x01,0x00,0xDE,0x6A};
Serial2.write(gps5hz,sizeof(gps5hz));
*****/
byte baudrate115200[] = {0xB5,0x62,0x06,0x00,0x14,0x00,0x01,0x00,0x00,0x00,0xD0,0x08,0x00,0x00,0x00,0xC2,0x01,0x00,0x07,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0xC4,0x96};
Serial2.write(baudrate115200,sizeof(baudrate115200));
delay(500); //give the GPS receiver time to process
Serial2.end();
Serial2.begin(115200);
delay(1000);
//fin ajout BR [/COLOR]
for(uint8_t i=0;i<=5;i++){
GPS_NewData();
LEDPIN_ON
delay(20);
LEDPIN_OFF
delay(80);
}
if(!GPS_Present){
SerialEnd(GPS_SERIAL);
SerialOpen(0,SERIAL_COM_SPEED);
}
#if !defined(GPS_PROMINI)
GPS_Present = 1;
#endif
GPS_Enable = GPS_Present;
#endif
-------------------------------------------------- modifications in HardwareSerial.cpp
comment from line 88 to 160
and comment from line 178 to 218
Code: Select all
[COLOR="Red"]/**** start section commented
#if !defined(USART0_RX_vect) && defined(USART1_RX_vect)
// do nothing - on the 32u4 the first USART is USART1
#else
#if !defined(USART_RX_vect) && !defined(SIG_USART0_RECV) && \
!defined(SIG_UART0_RECV) && !defined(USART0_RX_vect) && \
!defined(SIG_UART_RECV)
#error "Don't know what the Data Received vector is called for the first UART"
#else
void serialEvent() __attribute__((weak));
void serialEvent() {}
#define serialEvent_implemented
#if defined(USART_RX_vect)
SIGNAL(USART_RX_vect)
#elif defined(SIG_USART0_RECV)
SIGNAL(SIG_USART0_RECV)
#elif defined(SIG_UART0_RECV)
SIGNAL(SIG_UART0_RECV)
#elif defined(USART0_RX_vect)
SIGNAL(USART0_RX_vect)
#elif defined(SIG_UART_RECV)
SIGNAL(SIG_UART_RECV)
#endif
{
#if defined(UDR0)
unsigned char c = UDR0;
#elif defined(UDR)
unsigned char c = UDR;
#else
#error UDR not defined
#endif
store_char(c, &rx_buffer);
}
#endif
#endif
#if defined(USART1_RX_vect)
void serialEvent1() __attribute__((weak));
void serialEvent1() {}
#define serialEvent1_implemented
SIGNAL(USART1_RX_vect)
{
unsigned char c = UDR1;
store_char(c, &rx_buffer1);
}
#elif defined(SIG_USART1_RECV)
#error SIG_USART1_RECV
#endif
#if defined(USART2_RX_vect) && defined(UDR2)
void serialEvent2() __attribute__((weak));
void serialEvent2() {}
#define serialEvent2_implemented
SIGNAL(USART2_RX_vect)
{
unsigned char c = UDR2;
store_char(c, &rx_buffer2);
}
#elif defined(SIG_USART2_RECV)
#error SIG_USART2_RECV
#endif
#if defined(USART3_RX_vect) && defined(UDR3)
void serialEvent3() __attribute__((weak));
void serialEvent3() {}
#define serialEvent3_implemented
SIGNAL(USART3_RX_vect)
{
unsigned char c = UDR3;
store_char(c, &rx_buffer3);
}
#elif defined(SIG_USART3_RECV)
#error SIG_USART3_RECV
#endif
end section commented ********/[/COLOR]
void serialEventRun(void)
{
#ifdef serialEvent_implemented
if (Serial.available()) serialEvent();
#endif
#ifdef serialEvent1_implemented
if (Serial1.available()) serialEvent1();
#endif
#ifdef serialEvent2_implemented
if (Serial2.available()) serialEvent2();
#endif
#ifdef serialEvent3_implemented
if (Serial3.available()) serialEvent3();
#endif
}
[COLOR="red"]/******** start section commented
#if !defined(USART0_UDRE_vect) && defined(USART1_UDRE_vect)
// do nothing - on the 32u4 the first USART is USART1
#else
#if !defined(UART0_UDRE_vect) && !defined(UART_UDRE_vect) && !defined(USART0_UDRE_vect) && !defined(USART_UDRE_vect)
#error "Don't know what the Data Register Empty vector is called for the first UART"
#else
#if defined(UART0_UDRE_vect)
ISR(UART0_UDRE_vect)
#elif defined(UART_UDRE_vect)
ISR(UART_UDRE_vect)
#elif defined(USART0_UDRE_vect)
ISR(USART0_UDRE_vect)
#elif defined(USART_UDRE_vect)
ISR(USART_UDRE_vect)
#endif
{
if (tx_buffer.head == tx_buffer.tail) {
// Buffer empty, so disable interrupts
#if defined(UCSR0B)
cbi(UCSR0B, UDRIE0);
#else
cbi(UCSRB, UDRIE);
#endif
}
else {
// There is more data in the output buffer. Send the next byte
unsigned char c = tx_buffer.buffer[tx_buffer.tail];
tx_buffer.tail = (tx_buffer.tail + 1) % SERIAL_BUFFER_SIZE;
#if defined(UDR0)
UDR0 = c;
#elif defined(UDR)
UDR = c;
#else
#error UDR not defined
#endif
}
}
#endif
#endif
end section commented *****/[/COLOR]