Author Topic: what is the best way to do a pooled protocol-type comunication?  (Read 1130 times)

especialista

  • Newbie
  • *
  • Posts: 2
    • View Profile
Hello Roman! Hope everything is allright!

I'm trying to do a point-to-multi_point serial communication protocol using nrcommport and dataprocessor.

No troubles found in configuring nrcommport and dataprocessor.

The protocol is based in pooling type method, i.e, the computer will ask to each device, via ZigBee Network,  if it has data to be sent. if any data is present on the device, it will send one or more 6 byte lenght packets. The last packet sent by the device will enable the computer to ask the same question to the next device, and so on.

For each packet received, dataprocessor.ondatapacked id fired, as expected, and the data is processed.

Each device has a limited amount of storage (microcontroller based devices), so I have to ensure the comunication with each device will occur, at least once in a minute.

If the computer is running JUST the application that will handle the communication, it works fine. I tested it continuously for about 70 hours with no errors.

If any other "CPU resources killer" program (like a disk defragment tool, or antivirus scan) is running along, once in a while, I got exceptions on the data processor or one or more devices going offline due to absence of comunication and consequently, memory full.

So this makes me belive that for some unknown reason, data is not coming out from the computer to the devices, and, in the case of dataprocessor exceptions, data is being missed.

Is there any advice you could give me? How to improve communication priotiry in this case?

Thanks in advance!

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: what is the best way to do a pooled protocol-type comunication?
« Reply #1 on: April 18, 2012, 08:53:02 pm »
Hello

I'm sorry about delay with my reply. It seems like forum engine misses EMAIL notifications. We are trying to find and resolve problem.

About your problem.
TnrDataProcessor processes incoming data in TnrComm serial port monitor thread. Thread works in Normal priority. Theoretically it should not lost any data. Possible we will include public property for change Priority.

Also you can play with UseMainThread property too. Possible there are problems with waiting main from thread if this property is true.

Possible there are some problems in kernel drivers of your serial port adapter. It can lost data if CPU overload.

Roman Novgorodov
DeepSoftware LLC
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

especialista

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: what is the best way to do a pooled protocol-type comunication?
« Reply #2 on: April 26, 2012, 01:41:03 am »
I'll check that "UseMainThread" thing.
Thanks again!