Page 1 of 1

Trouble reading USB0

Posted: Thu Mar 26, 2015 7:36 am
by Canedje
Hello,

I'm quit new in this world and get my skills up doing programming the last time about 30 years ago.
I bought a B2.

I installed everthing and the system is working fine at an lan connection and SSH
I connect a smart energy meter with a P1 port to USB0.
This p1 port sends every 10 seconds a bunch of information about energy usage
I did write sw in Python to read the USB port and do write the selected data from the USB0 port in an my made format into an log file and rrdtool data base.
I activated a crontab running this program every 5 minutes.
Beside this I created a website on the raspberry pi showing the data bij text and rrdgraphs.
So far so good everything is running fine and smoothly.
But........

Every day roughly after about 24-25 hr running the Python program isn“t reading the USB port for about 15 a 20 minutes and not filling the logfile and rrdtool database. Or I find out is reading the USB port but the data is corrupted.
After about 15 a 20 minutes the programm is running fine again.

Somebody ideas what is causing this problem?
maybe something with stack overflow or buffers full?

help is appriciated

It is trying to read the


EDIT:
I do have an addition :
The python program is also writing the data to the screen every 5 minutes. By using the crontab command, the writing to the screen is not happening. Can this causing a kind off stack/buffer overflow, because the writing data is stored somewhere, by not displaying?

Re: Trouble reading USB0

Posted: Thu Mar 26, 2015 11:21 am
by DirkS
Canedje wrote:EDIT:
I do have an addition :
The python program is also writing the data to the screen every 5 minutes. By using the crontab command, the writing to the screen is not happening. Can this causing a kind off stack/buffer overflow, because the writing data is stored somewhere, by not displaying?
Programs / scripts started from cron don't have 'screen' to write to.
You can redirect the output to a file. Or change the script to write output to a logfile instead of the screen.

Re: Trouble reading USB0

Posted: Thu Mar 26, 2015 5:15 pm
by Canedje
DirkS wrote:
Canedje wrote:EDIT:
I do have an addition :
The python program is also writing the data to the screen every 5 minutes. By using the crontab command, the writing to the screen is not happening. Can this causing a kind off stack/buffer overflow, because the writing data is stored somewhere, by not displaying?
Programs / scripts started from cron don't have 'screen' to write to.
You can redirect the output to a file. Or change the script to write output to a logfile instead of the screen.

Thanks for the answer. But is this possible causing stackoverflow or something like that?

Edit: I did switch off the print commands. The problem still occurs. So de print is not causing the problem.
Another ideas?

Re: Trouble reading USB0

Posted: Fri Mar 27, 2015 11:54 am
by Canedje
I did install some debug sw in the program and found out that the p1 port sometime is sending out corrupted messages.
So it looks like it is no Raspberry Pi problem at all but the P1 port itself.