Machine control USB using a mega2560

Hello again.
@alexlan
One furher update/bugfix V3.3 of the arduino Code can be found on AgOpenGPS/AGOpenGpsMachineUSB_4.2.02_16pins_V3.3.ino at copy_of_v4201 · hagre/AgOpenGPS · GitHub

(I fixed some troubles with the timed loops. Buffer overflow/wrong starting sequenz until first intervall is finished.)

thanks @hagre for all your time i this, and sorry for a long time no response.
My regular mega’s don’t work with V3.3 and AOGv4.3.1 or v4.2
Do I have to cut on the board on the reset pin like you said earlier to make it work or
do I forget something?
Maybe better, I buy a mini mega and we are all happy :stuck_out_tongue:

@alexlan i have initialy got good resaults with the mini mega board, but suddenly i had the same connection problems again.

During trying to debug the AOG i found that it is enough to have a 1 second delay during the inizialistion of the seriel/usb connection. The reason for that is (my guess) that the mega needs a litle bit more time to boot, pull the nessesary pin down to gnd (connection to the serial chip) and establish a good serial/usb connection, otherwise it freezes AOG and or the mega. I made a pull request on github (the changed/corrected code is waiting to be insertet by the admin), but is not included by now. Make it possible to connect to MEGA2560 and include new MachineUSB_4310_MEGA16pins_V3.5.ino by hagre · Pull Request #164 · farmerbriantee/AgOpenGPS · GitHub We will see. …
If you are able to compile your own version of AOG you can use my repository as a source. GitHub - hagre/AgOpenGPS: Ag Precision Mapping, Section Control and Guidance Software
If you need help with the compiling, i can send you a updated copy of the latest released (and still a little bit bugy) version of AOG.

I discovert by surprise that connecting an external serial to usb converter on the TX and RX Pins and GND is solving the Problem as well (guess: due to one of the resistors pulling down to GND). maby just one more resiston can doo the job (have not tested jet)

Cutting the connection line at the “RESET-EN” position is not completly solving the problem, because the mega is not booting any more when a new usb connection is established (what is in general a nice feature to reset the arduino board for a clean start/boot).

As written in my last post use my latest arduino code https://github.com/hagre/AgOpenGPS/blob/my_Master/ArduinoCode/Machine_USB_4310/MachineUSB_4310_MEGA16pins_hagreV3.4.ino i have done a lot of debuging from the previous uploads.

Never the less, the mini mega is a cool board in a fantastic form factor.

best regards

Update:
First try of implementing 16 SectionSwitches if you are using Mega2560. ToDo - MAN switch (ON/AUTO/OFF) AgOpenGPS/MachineUSB_4310_MEGA16pins_IN_OUT_hagreV3.5.ino at my_Master-old_v4 · hagre/AgOpenGPS · GitHub

Sorry for the delay, been seeding and harvesting like crazy. Cool INO for the mega. Is there anything you need from AOG changed?

@BrianTee_Admin thanks for the nice anser. No problem. Seeding is much more important than software bugs!

As discribed in pull request Make it possible to connect to MEGA2560 and include new MachineUSB_4310_MEGA16pins_V3.5.ino by hagre · Pull Request #164 · farmerbriantee/AgOpenGPS · GitHub
There are just two lines of code to be inserted in GPS/Forms/SerialComm.Designer.cs line 502and 503.

//short delay for the use of mega2560, it is working in debugmode with breakpoint
System.Threading.Thread.Sleep(1000); // 500 was not enough

And i am still working to improve the .ino:
+Add Auto/Man/Main Switch
+upgrade with i2c port extender for input and output

ok i will add those, it’ll hold up the gui, but people can wait 1 second i am sure lol.

I’ll just remove the pull request - but know it will be in in the future code. Every time a github action is made always a risk something goes horribly wrong with winforms.