Hallo,
ich versuch schon eine ganze Weile das
GPS-Bee-Modul(http://www.seeedstudio.com/wiki/GPS_Bee_kit) von
Seeedstudio mit dem Raspberry Pi B v2
(http://elinux.org/RPi_Low-level_peripherals) unter Zuhilfenahme von
wiringPi(http://wiringpi.com/reference/serial-library/) anzusprechen, es
gelingt mir allerdings nicht :/.
Eine Skizze der Schaltung befindet sich im Anhang, der verwendete Code
steht unten. Der Gleiche Aufbau mit einem Arduino-Mega 2560, dessen
Serieller Schnittstelle und einem entsprechenden Programm funktionierten
einwandfrei.
Update!
Es funktioniert! Leider nur ab und an, ich erhalte dann nur Fragmente
der Daten, die ich haben möchte (Bsp. unten).
>>$GPGGA,181506.000,5101.0737,N,00853.1000,E,1,9,0.93,436.0,M,47.8,M,,*5 7
$GPGSA,A,3,22,11,14,19,27,28,32,01,20,,,,1.25,0.93,0.83*05
$GPGSV,3,1,12,11,74,275,28,32,59,211,25,01,52,286,25,19,50,166,21*7B
$GPGSV,3,2,12,14,39,080,19,22,28,060,20,28,26,299,38,27,20,157,14*7C
$GPGSV,3,3,12,<<
Zu Grunde liegen folgende Beispiele:
http://iamzxlee.wordpress.com/2013/09/08/gps-bee-kit-part-2-2/
http://nicohood.wordpress.com/2014/04/18/arduino-raspberry-pi-serial-communication-protocol-via-usb-and-cc/
1 | #include<iostream>
|
2 | using namespace std;
|
3 |
|
4 | #include <wiringPi.h>
|
5 | #include <wiringSerial.h>
|
6 |
|
7 | #define DELAY 5
|
8 | #define TIMEOUT 3000
|
9 |
|
10 | int main()
|
11 | {
|
12 | int fd = 0;
|
13 | bool state = false;
|
14 | char device[] = "/dev/ttyAMA0";
|
15 | unsigned long time;
|
16 |
|
17 | if((fd = serialOpen(device, 9600)) < 0) {
|
18 | cout << "unable to open serial device" << endl;
|
19 | return 0;
|
20 | }
|
21 |
|
22 | if(wiringPiSetup () == -1) {
|
23 | cout << "unable to start wiringPi" << endl;
|
24 | return 0;
|
25 | }
|
26 |
|
27 | cout << "search for signal [fd = " << fd << "]\n" << endl;
|
28 |
|
29 | time = millis();
|
30 | cout << ">>";
|
31 |
|
32 | while(true) {
|
33 | while(serialDataAvail(fd) > 0) {
|
34 | if(!state) {
|
35 | state = true;
|
36 | delay(1000);
|
37 | }
|
38 | cout << char(serialGetchar(fd));
|
39 | delay(DELAY);
|
40 | }
|
41 |
|
42 | if(state) {
|
43 | cout << "<<" << endl;
|
44 | break;
|
45 | }
|
46 |
|
47 | if(millis() - time >= TIMEOUT) {
|
48 | cout << "<<\n\t...timeout (" << TIMEOUT / 1000.0 << "s)" << endl;
|
49 | return 0;
|
50 | }
|
51 | }
|
52 |
|
53 | serialClose(fd);
|
54 |
|
55 | cout << "\n\n\t...done" << endl;
|
56 | return 0;
|
57 | }
|