Communication problem with USR module

I use a pcbV2 with an f9p on a USR module in order to have only one network cable. that works well. however after a while I noticed that the current measurement is not decoded by AOG.

amp

however, when I connect the pcb via USB without any other modification than disconnecting the USR module, the data is received.

so I think there is a miss somewhere, I don’t know if it happens in pure UDP. however I did not notice any difference in the PGN or data format between autosteer USB vs UDP.

PS: tested from version 5.6.2 to 5.6.11

I would say your USR module / configuration is the problem.

I would say the two different PGN’s (steering PGN & current reading PGN) are getting lumped into one UDP packet and although I haven’t looked but AgIO can’t read two PGN’s in one UDP packet, there must be one PGN per packet.

interesting. in the ino autosteer sends it and separated, but the usr module would wait to have a complete package before sending it? (like some wifi router) this would explain other weird symptoms I had with autoguiding.

now i saw options for packet size limit or flow control settings in usr module… but do you have any idea which settings to use?

or maybe it would be necessary to add a delay between the sending of the 2 pgn so that it is sent separately.

Well, I tried a lot of settings on the USR module, but nothing worked. I added a very small delay in the arduino code and the magic worked.

//Steer Data 2 -------------------------------------------------
            if (steerConfig.PressureSensor || steerConfig.CurrentSensor)
            {
              if (aog2Count++ > 2)
              {
                delay(5); //added a delay to send two separate packets for PGN 253 and PGN 250 on a USR module
                //Send fromAutosteer2
                PGN_250[5] = (byte)sensorReading;

                //add the checksum for AOG2
                CK_A = 0;
                for (uint8_t i = 2; i < PGN_250_Size; i++)
                {
                    CK_A = (CK_A + PGN_250[i]);
                }
                PGN_250[PGN_250_Size] = CK_A;

                Serial.write(PGN_250, sizeof(PGN_250));
                aog2Count = 0;
              }
            }

Nice so now you can see the problem, but adding a delay is never the correct answer to the problem. The controller has much more important tasks to do rather than pushing pause.

1 Like

You are right, using a delay is never too good.

So I modified the code again. I moved the sending of the PGN250 to the end of the timed loop.

so here is a more academic solution.

Commenting out the sending of the PGN, we only increment aog2Count.

            //Steer Data 2 -------------------------------------------------
            if (steerConfig.PressureSensor || steerConfig.CurrentSensor)
            {
              aog2Count++; //added a delay to send two separate packets for PGN 253 and PGN 250 on a USR module
              /*if (aog2Count++ > 2)
              {
                //Send fromAutosteer2
                PGN_250[5] = (byte)sensorReading;

                //add the checksum for AOG2
                CK_A = 0;
                for (uint8_t i = 2; i < PGN_250_Size; i++)
                {
                    CK_A = (CK_A + PGN_250[i]);
                }
                PGN_250[PGN_250_Size] = CK_A;

                Serial.write(PGN_250, sizeof(PGN_250));
                aog2Count = 0;
              }*/
            }

the sending of the PGN is moved to the end of the timed loop and will be sent if aog2Count is greater than 2

      //send empty pgn to AgIO to show activity
      if (++helloCounter > 10)
      {
        Serial.write(helloAgIO,sizeof(helloAgIO));
        helloCounter = 0;
      }

      //Send fromAutosteer2
      if (aog2Count > 2)
      {
        PGN_250[5] = (byte)sensorReading;
        
        //add the checksum for AOG2
        int16_t CK_A = 0;
        CK_A = 0;
        for (uint8_t i = 2; i < PGN_250_Size; i++)
        {
            CK_A = (CK_A + PGN_250[i]);
        }
        PGN_250[PGN_250_Size] = CK_A;
        
        Serial.write(PGN_250, sizeof(PGN_250));
        aog2Count = 0;
      }
      
    } //end of timed loop
1 Like

That’s a better solution haha :+1: