Serial port reading problem

Started by Stinde, November 22, 2012, 03:32:05 pm

Previous topic - Next topic

Stinde

Hi,

I have ZICM2410 SNAP radio module connected to Olinuxino AUART (UEXT port). Another ZICM2410 writes sensor data over he air to module connected to Olinuxino UART. A php script is reading the serial port and writing the data into a remote server database.
The beginning of the each data packet is corrupted, but the rest of the packet, maybe 80%, is correct.
I installed jpnevulator serial sniffer on the Olinuxino and read the data. The data is correct and then I stop jpnevulator and start my script and the script reads also correct data.
I checked the port settings with stty before and after jpnevulator, but I couldn't find any difference in the settings.
Here is the beginning of the php-script. I'll set the baud rate manually with stty before running the script.
<?php
$fh=fopen("/dev/ttySP1","r") or die("Not Opening");

while(!feof($fh))
{
        $buf=fgets($fh);
.
.
.

Any ideas how to correct this?

Best Regards,

Timo