Hi,
I am using Hifive1 (version 1) board. In that i am reading PPM signal continuously from the RC receiver.
Also i am using Neo 6m GPS using software uart.
My problem is when i read receiver’s value after setting up the GPS
the receiver’s value becomes constant in other words it is not at all changing even if i move the RC controller’s Joysticks.
This is not the exact code but is the sequence of what i am doing actually.
#include <SoftwareSerial32.h>
SoftwareSerial32 ss(15, 16); // RX, TX
int ppm_pin = 17;
pinMode(ppm_pin, INPUT_PULLUP);
ppm_pinmask = digitalPinToBitMask(ppm_pin); //Setup interrupt
attachInterrupt(digitalPinToInterrupt(ppm_pin), ISR, RISING);
set_csr(mstatus, MSTATUS_MIE);
Serial.println(">>ReceiverStart...");
-->**I am getting values here**
while (receiver_input_channel_3 < 990 || receiver_input_channel_3 > 1020 || receiver_input_channel_4 < 1400) {
receiver_input_channel_3 = convert_receiver_channel(3); //Convert the actual receiver signals for throttle to the standard 1000 - 2000us
Serial.print(receiver_input[3]); Serial.print("-"); Serial.println(receiver_input_channel_3);
}
gps_setup(); <----**This is GPS setup**
—>values became still while (1) {
Serial.print(receiver_input[1]); Serial.print("-");
Serial.print(receiver_input[2]); Serial.print("-");
Serial.print(receiver_input[3]); Serial.print("-");
Serial.print(receiver_input[4]); Serial.print("-");
Serial.print(receiver_input[5]); Serial.print("-");
Serial.println(receiver_input[6]);
//delay(100);
}
void gps_setup(void) {
ss.begin(9600);
delay(500);
//Disable GPGSV messages by using the ublox protocol.
uint8_t Disable_GPGSV[11] = {0xB5, 0x62, 0x06, 0x01, 0x03, 0x00, 0xF0, 0x03, 0x00, 0xFD, 0x15};
ss.write(Disable_GPGSV, 11);
delay(350); //A small delay is added to give the GPS some time to respond @ 9600bps.
//Set the refresh rate to 5Hz by using the ublox protocol.
uint8_t Set_to_5Hz[14] = {0xB5, 0x62, 0x06, 0x08, 0x06, 0x00, 0xC8, 0x00, 0x01, 0x00, 0x01, 0x00, 0xDE, 0x6A};
ss.write(Set_to_5Hz, 14);
delay(350); //A small delay is added to give the GPS some time to respond @ 9600bps.
//Set the baud rate to 57.6kbps by using the ublox protocol.
uint8_t Set_to_57kbps[28] = {0xB5, 0x62, 0x06, 0x00, 0x14, 0x00, 0x01, 0x00, 0x00, 0x00, 0xD0, 0x08, 0x00, 0x00,
0x00, 0xE1, 0x00, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE2, 0xE1
};
ss.write(Set_to_57kbps, 28);
delay(200);
ss.begin(57600);
delay(400);
}
example output:
> 1191-1026
> 1191-1026
> 1191-1026
> 1191-1026
> 1191-1026
> 1191-1026
> 1191-1026
> 1191-1026
> 1193-1029
> 1193-1029
> 1193-1029
> 1193-1029
> 1189-1023
> 1189-1023
> 1189-1023
> 1189-1023
> 1189-1023
> 1189-1023
> 1189-1023
> 1189-1023
> 1189-1023
> 1189-1023
> 1189-1023
> 1189-1023
> 1188-1021
> 1188-1021
> 1188-1021
> 1188-1021
> 1188-1021
> 1188-1021
> 1188-1021
> 1188-1021
> 1188-1021
> 1186-1018
> >Setup Done.
> (Became constant and not changing)
> 1043-1043-1043-1043-1044-1043
> 1043-1043-1043-1043-1044-1043
> 1043-1043-1043-1043-1044-1043
> 1043-1043-1043-1043-1044-1043
> 1043-1043-1043-1043-1044-1043
> 1043-1043-1043-1043-1044-1043
> 1043-1043-1043-1043-1044-1043