PDA

View Full Version : Freeze the communication after 30 minutes



Pedro Pinto
- 22nd May 2009, 12:00
Hello

In my apliacation, I will make a scan to several pcb boards through serial communication. For test purpose, i have only one pcb connect to the PC trough a USBtoRS232 converter, later, it must work as a wireless network. On the boards scan procedur, the PC application send data to ask the boards one after another, if they have new data to store on the PC aplicattion. Everytime the asked PCBboard have no data, after a timeout on the PC applications, the programm on the PC ask the next pcb board, and so on...It works about 15...30 Minutes perfectly, after that period, in one of the scan phases, the pcb board that have new data, try to send and freeze the communication, the program on the PC doesn't receive the data anymore. I have to unplug the USBtoRS232 converter and plug again and restart the PC application. Have somebody an idea how to solve this problem. Due this application have to work continually and autonomous, nobody won't exist to unplug and plug the USBtoRS232 again restart the PC application.

Thanks
Best regards
Pedro

''Here part of code that freeze the communication after 30 minutes with 18F4520



engine = 2

scanboards:
SERIN2 rx_,bmode,500,final,[wait ("P"),dec2 function,dec3 board, dec3 dumy] ''receive the comando what to do
'
' ******************* PC ask the if have new data, the flag reg_complet have this information *******************
if (function = 30) and (engine = board) and (reg_complet = 1) then

''read the data from the 18F4520 eeprom
read 10,tmp0
read 11,tmp1
read 12,tmp2
read 13,tmp3
read 14,tmp4
read 15,tmp5
read 16,tmp6
read 17,tmp7
read 18,tmp8
read 19,tmp9
read 20,tmp10
read 21,tmp11
read 22,tmp12
read 23,tmp13
read 24,tmp14
read 25,tmp15
read 26,tecnico1
read 27,tecnico0
'
''send the new data to the PC
serout2 tx_,bmode,["dumi",";",hex2 tmp0,";",hex2 tmp1,";",hex2 tmp2,_
";",hex2 tmp3,";",hex2 tmp4,";",hex2 tmp5,_
";",hex2 tmp6,";",hex2 tmp7,";",hex2 tmp8,_
";",hex2 tmp9,";",hex2 tmp10,";",hex2 tmp11,_
";",dec3 tmp12,";",dec3 tmp13,";",dec3 tmp14,_
";",hex2 tmp15,";",hex4 tecnico,13,10]
serout2 tx_,bmode,["y",13,10] ''end of data
'
SERIN2 rx_,bmode,5000,final,[wait ("OK"),dec3 board] ''wait during 5 seg a confirmation from the PC application that have received the new data
if board = engine then
reg_completo = 0 ''data received, clear the flag that have no more new data to send
write 4, reg_complet ''save the flag for posterior test
endif
endif
final:
return

Jerson
- 22nd May 2009, 16:13
Pedro

Are you sure it's not a USB-RS232 converter problem? I've seen this issue before. If possible, try your program with a plain serial port available on some old PC. Most likely it is a converter problem.

Jerson

ardhuru
- 22nd May 2009, 17:52
Pedro, as Jerson pointed out its most likely the USB-to-serial converter.

Also, make sure your PC doesnt go into screen-saver mode; that might cause hassles with your USB-to-serial.

Anand

Archangel
- 22nd May 2009, 19:37
Pedro, as Jerson pointed out its most likely the USB-to-serial converter.

Also, make sure your PC doesnt go into screen-saver mode; that might cause hassles with your USB-to-serial.

Anand . . . Screen saver and hard drive suspend mode, you can turn all that stuff off . . .

Pedro Pinto
- 23rd May 2009, 01:06
Hello

I have tested on a old PC, direct to RS232 input, and it works without freeze
I will try make tests with another USBtoRS232 converter. The applications must work on a Notebook and today they have not RS232 input anymore.
My USBtoRS232 converter have a Prolific chip and the drives for that are uptodate.

Regards
Pedro

ardhuru
- 23rd May 2009, 07:46
If things dont work, here are 2 options;

a) migrate the project to a USB chip and use a virtual com port on the notebook

b) buy a PCMCIA based serial port card; these are true 16551 UARTs, and are almost as good as having serial ports built-in into the notebook.

Regards,

Anand