AgIO freezes when starting a field

Hi everyone,

i have a problem with AgIO. I flashed a modified version of the Autosteer_USB_v5_0 on a Canbed FD board (which acts as a Arduino Leonardo). I modified it to control a Danfoss PVED-CC.

When i only open AgIO (without AgOpenGPS) and select the right Com Port AgIO shows between 28 and 35 bytes/s (orange symbol with the arrows pointing out of the box).
When i start AgOpenGPS i had two behaviours:
1 - AgIO freezes directly
2 - AgIO shows 140 bytes/s in and out and freezes as soon as i open a field.

When i connect with putty to the board i can see ▒▒G comming in from the port. I think it is the
uint8_t helloAgIO[] = {0x80,0x81, 0x7f, 0xC7, 1, 0, 0x47 };
At least the G is 47 in HEX.
I also tested another computer, no difference. AgOpenGPS is running in Simulator mode.

Any recommandation where to look at?

Divide your system to its separate comms parts.

Connect only to your gps, see if it freezes.

Connect only to your corrections source, see result.

Connect only to your nav box, see result.

The unhappy offender should reveal itself.

If not delete your current AOG file, Download the latest greatest.

Try a different PC, see result.

Try different cables, see result.

The only module connected is the Autosteer board (canbed FD / Arduino Leonardo). So not difficult to find the offender :wink:
Just not sure if it is because of a bug/incompatibilty in/with AgIO.
When only viewed with putty the board happily sends its helloAgIO message.

The installation is a fresh install of the latest greatest.
Already tried a different PC and different cable.

Ah CAN

I am not sure about your specific hardware, alot of the CAN development lately seems to be on teensy4.1 The resident CANspert on the forum is @CommonRail

Just a thought, I assume your running in simulator mode are you opening a new field or a saved field?

I have seen it catch a few people out when the field is too far away from the current GPS location, then there is too much maths, then AgOpen gets overloaded and funny things happen.

Doesn’t the more recent AoG move the simulator position to within the field boundary when loading a field?

Yes, it should move the the position next to the field. I also tried to create a new field in simulator.

But most of the time, AgIO freezes already when I load AgOpenGPS.

Does this also happen whithout any USB connected?
I mean in sim

No. If i disconnect the board AgIO says something like “A non existing ComPort selected” and recovers from the freeze state. If i then connect USB again and select the port to connect, it freezes again.

Try to use a non modified ino version on your “Leonardo” board

I looked into the source code.

It freezes in line 321 of SerialComm.Designer.cs

if (spModule1.IsOpen)
            {
                try
                {
                    //spModule1.Write(items, 0, numItems);
                    traffic.cntrModule1Out += items.Length;
                    //rtxtStatus.Text += BitConverter.ToString(items) + "\r\n";
                }

If i comment the spModule1.Write(items, 0, numItems); then AgIO runs fine.

I guess it is not a problem of AgIO directly but of the Serial library?

Here is a screenshot of the call stack

and the stop Point

I am at the end of my expertise :neutral_face: :wink:

Edit:
If i always sent the same, AgIO does not crash

Edit2: That was not true. It was just because i had no field open. So still crashing.
I can make it transmit data when sending the same value and unplug and plug in the cable again. Even if a field is open.
Could it be some timing thing between sending and receiving specific data (e.g. arduino settings or something like this)?