GPS,ttyS1,NMEA,PERL

Простое чтение данных.

#!/usr/bin/perl
    use GPS::NMEA;
    use Data::Dumper;
    
    my $gps = GPS::NMEA->new(Port => '/dev/cuaa0', # or COM5: or /dev/ttyS0
                             Baud => 4800);
    while(1) {
        $gps->parse;
    
        # Dump internal NMEA data:
        $gps->nmea_data_dump;
    
        # Alternative to look at the internal NMEA data:
        require Data::Dumper;
        print Data::Dumper->new([$gps->{NMEADATA}],[])->Indent(1)->Useqq(1)->Dump;
    }

Печатаем координаты.


 #!/usr/bin/perl
    use GPS::NMEA;
    use Data::Dumper;
    
    my $gps = GPS::NMEA->new(Port => '/dev/cuaa0', # or COM5: or /dev/ttyS0
                             Baud => 4800);
    while(1) {
        $gps->parse;
    
        # Dump internal NMEA data:
        $gps->nmea_data_dump;
    
        # Alternative to look at the internal NMEA data:
        require Data::Dumper;
        print Data::Dumper->new([$gps->{NMEADATA}],[])->Indent(1)->Useqq(1)->Dump;
    }

Дамп всех NMEA данных с порта.

 #!/usr/bin/perl
    use GPS::NMEA;
    use Data::Dumper;
    
    my $gps = GPS::NMEA->new(Port => '/dev/cuaa0', # or COM5: or /dev/ttyS0
                             Baud => 4800);
    while(1) {
        $gps->parse;
    
        # Dump internal NMEA data:
        $gps->nmea_data_dump;
    
        # Alternative to look at the internal NMEA data:
        require Data::Dumper;
        print Data::Dumper->new([$gps->{NMEADATA}],[])->Indent(1)->Useqq(1)->Dump;
    }

GPIO + Cubieboard2 + Debian Wheezy

Cubieboard / Cubietruck Debian Wheezy SD card image

Fex Guide – Описание FEX стандарта

Cubieboard1&2_HW.pdf

/boot/cb2-hdmi.bin
# bin2fex cb2-hdmi.bin > cb2-hdmi.txt
# fex2bin cb2-hdmi.txt cb2-hdmi.bin

PH20 – Зеленый светодиод на плате.

Все порта должны быть прописаны а также не должны пересекаться.

[gpio_para]
gpio_used = 1
gpio_num = 3
gpio_pin_1 = port:PH20<1><default><default><1>
gpio_pin_2 = port:PH21<1><default><default><1>
gpio_pin_3 = port:PD1<1><default><default><1>

#cd /sys/class/gpio
#ls -al
 export
 gpiochip1 -> ../../devices/platform/gpio-sunxi/gpio/gpiochip1
 unexport

Активация порта PH20. (echo 3 -> для PD1)
# echo 1 > /sys/class/gpio/export 
# ls -al
 export
 gpio1_ph20 -> ../../devices/platform/gpio-sunxi/gpio/gpio1_ph20
 gpiochip1 -> ../../devices/platform/gpio-sunxi/gpio/gpiochip1
 unexport

Включаем режим вывода.
# echo out > gpio1_ph20/direction 

Читаем из порта.
# cat gpio1_ph20/value
 0

Записываем в порт.
# echo 1 > gpio1_ph20/value
# cat gpio1_ph20/value
 1


Проверенно, работает.

http://blog.radiotech.kz/blog/cubieboard/34.html

gpio_defination_large

Cubieboard / Cubietruck Debian Wheezy SD card image

Cubieboard / Cubietruck Debian Wheezy SD card image.

  • Debian Wheezy 7.5 based
  • Kernel 3.4.91 with broad hardware support, headers included
  • Ethernet adapter with DHCP and SSH server ready on default port (22) with regenerated keys @ first boot
  • Wireless adapter with DHCP ready but disabled (/etc/network/interfaces, WPA2: normal connect or AP mode)
  • Enabled audio devices: analog, spdif and I2S
  • Advanced IR driver with RAW RX and TX
  • Bluetooth ready (currently working only with supported external USB devices)
  • Clustering / stacking
  • USB redirector – for sharing USB over TCP/IP (disabled by default /etc/init.d/rc.usbsrvd)
  • root file-system auto resize
  • Graphics desktop environment upgrade ready
  • NAND and SATA install script included (/root)
  • Disabled LED blinking, logo, boot messages (/etc/init.d/disable_led.sh, kernel.config, kernel parameters in uEnv.txt)
  • Total memory is exactly 2000Mb (disabled all memory reservations for GPU)
  • Login script shows Cubietruck / Cubieboard 2 auto MOTD with current CPU temp, hard drive temp & actual free memory
  • MAC address from chip ID, manual optional
  • Fastest Debian mirror auto selection @ first boot
  • root password=1234
  • sunxi-tools included: fex2bin, bin2fex, nand-part
  • Performance tweaks:
    • /tmp & /log = RAM, ramlog app saves logs to disk daily and on shut-down
    • IO scheduler NOOP for SD, CFQ for sda (mechanical hard drive). (change in /etc/sysfs.conf)
    • journal data writeback enabled. (/etc/fstab)
    • commit=600 to flush data to the disk every 10 minutes (/etc/fstab)
    • optimized CPU frequency scaling 480-1200Mhz with interactive governor and small 20% overclock (/etc/init.d/cpufrequtils)
  • Known bugs or limitations
    • On board Bluetooth unstable / unusable (firmware issue)
    • NAND install script sometime fails. Dirty but working workaround – installing Lubuntu to NAND with Phoenix tools and run the nand-install again.
    • Gigabit ethernet transfer rate is around 50% of its theoretical max rate (hardware or firmware issue)
    • Shutdown, reboot and battery troubles regarding poor AXP chip driver (firmware issue, probably solved in development kernel)
  • Unzipped images can be written with Image Writer on Windows or with DD command in Linux/Mac (dd bs=1M if=filename.raw of=sd card device). Kernel package should be uncompressed under root user to / Change boot parameter if your old kernel has different name.