Registration Notice

Due to increased spam, forum registration must be manually approved by a moderator! Please see this post for instructions.

*

Offline Lotuswins

  • 154
    • View Profile
  • Roseburg, oregon
Re: Testing TCB Firmware with Stock Arduino Mega
« Reply #45 on: September 09, 2019, 06:44:54 PM »
Hi all,

So I'm getting started on this, and have a Mega, a spare sabertooth, a spare taigen sound card, etc. all plugged into a test board.  I'm having trouble understanding where to plug in the DIP switch inputs.  The OP schematic shows pins 91,92,87,86,85 for sw 1 thru 5.  Yet the Mega diagrams don't show those pins coming out?  Are they reassigned in the DIY firmware? 

Also, I seem to have gotten the board to respond to PPM, and can start it (engine starting sound) but then it automatically shuts down, won't stay running.  Any thoughts? so far all the DIP inputs are not connected, is that the issue perhaps?

thanks, Jerry

*

Offline LukeZ

  • 980
    • View Profile
  • Edinburgh, Scotland
Re: Testing TCB Firmware with Stock Arduino Mega
« Reply #46 on: September 09, 2019, 08:07:26 PM »
Hi Jerry, when referring to the pinout PDF at the beginning of this thread, you want to use the pin numbers in the Ard column (for "Arduino"). You're looking at the Atm column (for "ATmega") which are the pin numbers on the physical chip itself. But Arduino renames things and that is what is marked on your Mega board.

Therefore Dipswitches 1-5 will be Arduino pins A6, A5, A10, A11, and A12.

Any number of things could be going on with your rebooting issue. It is not likely to be anything related to the dipswitches. Are you possibly trying to power everything with USB? It won't be able to handle the load. Try using a battery, and try removing the Taigen sound card and see if that makes any difference. You can use USB for testing responsiveness to your radio commands using Snoop, but as soon as you start attaching peripherals you need a real power source.
NO SUPPORT THROUGH PM - Read why
Need a forum account? Read here
Open Panzer FAQs

*

Offline Lotuswins

  • 154
    • View Profile
  • Roseburg, oregon
Re: Testing TCB Firmware with Stock Arduino Mega
« Reply #47 on: September 10, 2019, 05:01:26 PM »
Thanks Luke, I overlooked the pinout pdf, thinking it was just for the TCB.....dooh!

So I got the dip switch included with jumpers, but still no joy on the staying running.  I then hooked up an LED for the MG, and it was blinking like a low voltage issue.  So I disabled the LV cutoff, and bingo it now stays running.  I'm using an external source for all 5 volt power, and I checked with my Fluke, all voltages rock solid at 5v and 7.2v.  However, the MG light blinks on startup, etc. but no machine gun sound nor blinking from pin 20.  Hmmmm, more work to do. 

Fun to be trouble shooting again....

Jerry

arduinotest.JPG
Testing TCB Firmware with Stock Arduino Mega arduinotest.JPG
Views: 215

*

Offline Lotuswins

  • 154
    • View Profile
  • Roseburg, oregon
Re: Testing TCB Firmware with Stock Arduino Mega
« Reply #48 on: September 10, 2019, 05:06:41 PM »
Okay, had my channels crossed....MG now working!!  on to the other LEDs.....jerry

*

Offline LukeZ

  • 980
    • View Profile
  • Edinburgh, Scotland
Re: Testing TCB Firmware with Stock Arduino Mega
« Reply #49 on: September 10, 2019, 05:26:42 PM »
I'm using an external source for all 5 volt power, and I checked with my Fluke, all voltages rock solid at 5v and 7.2v.
That is slightly confusing, typically we provide an Arduino board with something higher than 5 volts and the Arduino steps it down to 5 with its onboard regulator. In fact these regulators typically require at least 1 volt higher and often more even to function. So if you are feeding 5 volts directly to the Arduino it could be browning out.

Now using a second 5 volt supply to drive external 5 volt components (such as LEDs or the Taigen sound card or a recoil servo) is fine, that is like using a BEC in an RC truck. But give the Arduino whatever your full battery voltage is on the VIN input.
NO SUPPORT THROUGH PM - Read why
Need a forum account? Read here
Open Panzer FAQs

*

Offline Lotuswins

  • 154
    • View Profile
  • Roseburg, oregon
Re: Testing TCB Firmware with Stock Arduino Mega
« Reply #50 on: September 10, 2019, 08:36:39 PM »
Hi Luke, I guess I explained it poorly.  I'm putting 7.4 volts onto vin on the arduino board and not using 5v out of the arduino for anything.  The sabertooth is also powered by the 7.4 volt source.  I'm using a 5v source independent of the arduino for the receiver, sound board, etc., connected to a common ground.

Perhaps the little jumpers are too small to feed the arduino power in?  causing a voltage drop and the voltage shutdown?? 

jerry

*

Offline LukeZ

  • 980
    • View Profile
  • Edinburgh, Scotland
Re: Testing TCB Firmware with Stock Arduino Mega
« Reply #51 on: September 10, 2019, 10:33:25 PM »
Ok, in that case I'm sure you have plenty of power to the Arduino and your little jumpers are fine. The chip itself draws very little current and your external devices are being powered independently of the onboard regulator on the Arduino so power shouldn't be a problem. 

You're right though that you should disable the LVC since you don't have a voltage sense circuit hooked up and that will just cause issues, but anyway you figured that out.

You'll have to keep troubleshooting. Try disconnecting peripherals and see if the program still works, try looking at Snoop to see if anything informative shows up or if you can pinpoint what specific actions cause the reset.

Due to the infinite number of possible combinations it is also possible to create a combination of trigger functions that will cause a reset, but these would be illogical combinations and I'm sure you have a very simple and abbreviated list going anyway.

I see you're using the PWM-to-PPM converter again, another thing to try would be a PPM/digital receiver directly.

I'm sure it will be something simple in the end but you'll have to keep sleuthing to narrow down what the issue might be.
NO SUPPORT THROUGH PM - Read why
Need a forum account? Read here
Open Panzer FAQs

*

Offline Wibbly

  • 43
    • View Profile
  • Wales, UK
Re: Testing TCB Firmware with Stock Arduino Mega
« Reply #52 on: October 03, 2019, 01:31:45 PM »
After being tied up on other things, I finally pulled an Arduino 2560 out of a dusty box, and set about getting the OP firmware onto it.

A quick tip for anyone thinking of making their own TCB using an Arduino board. If you buy a cheap Chinese 2560 you may hit problems trying to get the board to communicate with your PC.

The reason is that FTDI/USB is a proprietary chip, not public domain. The people at FTDI realised that the Chinese had cloned their chip on Arduino boards so revamped their drivers so that they would only work on genuine USB chips. Some Chinese boards work, others don't. Mine didn't.

I had an ancient laptop in a drawer that I had used for previous Arduino projects, and that had a Legacy driver on it. This driver was released before the cloning problem, so has no internal checks for a genuine chip.

It worked! I downloaded the DIY-Hex firmware onto the cloned 2560.

I have a PWM converter on the way, and will then set about building the rest of the Open Panzer system, my only concern at the moment is getting the standard HL style motor driven turret rotation/elevation motors to work, rather than replacing them with servo's. Same goes for the Torro mechanical recoil.

Other than that, a muzzle flash is the only thing to get working and it will all be good to go.
Been into 1/16 tanks for over 10 years.

*

Offline LukeZ

  • 980
    • View Profile
  • Edinburgh, Scotland
Re: Testing TCB Firmware with Stock Arduino Mega
« Reply #53 on: October 03, 2019, 05:33:52 PM »
Hi Wibbly,

You don't have to use servos specifically for the turret motor controls. The RC outputs can drive servos yes, but also any standard RC speed control. AlieExpress/Banggood have many very small and extremely inexpensive brushed ESCs that will drive your turret motors and that is the easiest way to go.

If you want to replicate what is on the TCB itself, it uses an L298 motor driver chip. This chip requires multiple connections to the 2560 in addition to power and ground and the motor outputs. You can buy L298 breakout boards from China and they should work, but the wiring will be more of a mess and I don't think you will save any space.

The mechanical recoil motor will also require some other components, namely a MOSFET or transistor to drive the motor, and various passive components such as diodes, resistors and capacitors. These are all shown in the schematic under the heading "Recoil Power and Trigger." That one is not going to be so easy but if you are comfortable assembling your own circuits you can give it a try.

The muzzle flash is easier and requires only a PNP transistor and a resistor. Of course on the TCB we are using surface mount components but a bog-standard 2N3906 transistor will work fine here and you can buy them for a few pennies anywhere in the world.

It might be worth posting your progress and questions in the OP forum thread so that all the information can remain in one place, and there is already a good deal of discussion over there that you will find useful.

Good luck!
NO SUPPORT THROUGH PM - Read why
Need a forum account? Read here
Open Panzer FAQs

*

Offline LukeZ

  • 980
    • View Profile
  • Edinburgh, Scotland
Re: Testing TCB Firmware with Stock Arduino Mega
« Reply #54 on: October 03, 2019, 05:34:15 PM »
One more quick comment - in my experience some of the PWM-PPM converters are really flaky. Yours might work fine but even so the wiring with individual PWM channels is really a mess. It would be much better to use a native PPM/iBus/or SBus receiver. Yes it's true, without any additional components a Mega2560 can only read PPM or iBus. If you want to read SBus you need to add a transistor and 2 resistors. Since you are already getting prepared to add external components that is fairly trivial to do and would be much cleaner of an installation and cheaper to boot. Look at the schematic for the resistor values, as for the transistor in this case any standard NPN should be fine such as a 2N3904 or BC337.
NO SUPPORT THROUGH PM - Read why
Need a forum account? Read here
Open Panzer FAQs

*

Offline Wibbly

  • 43
    • View Profile
  • Wales, UK
Re: Testing TCB Firmware with Stock Arduino Mega
« Reply #55 on: October 19, 2019, 08:04:00 AM »
Can I load the DIY firmware using the IDE?

Whilst playing around with the tx, Read Radio etc, my Windows 10 laptop decided to stop uploading to the Arduino. It connects, but throws up an AVRDude.exe error message

"The application was unable to start correctly (0x000007b). Click OK to close the application."

when I try to flash.

It looks like the firmware is corrupted on the 2560, I've reinstalled the OP interface but no joy. Re-installed drivers and no joy either.

The 2560 lights up, the VR hasn't blown, and the OP interface will connect. It just won't identify the port COM4, which is the only one on offer.

I assumed that the USB I/O had blown and ordered another 2560, but then fired up my Linux desktop. I had the same result, no port found. After a bit of digging around I have the 2560 'apparently' talking to the pc, eg the serial monitor works.

In order to test the comms, how do I upload the DIY hex file onto the 2560, I can't use the OP interface as this is Windows based. Never done this before.

Hoping someone can help?  It's got to be worth a try, though the 2560 may have toasted something :(
Been into 1/16 tanks for over 10 years.

*

Offline LukeZ

  • 980
    • View Profile
  • Edinburgh, Scotland
Re: Testing TCB Firmware with Stock Arduino Mega
« Reply #56 on: October 19, 2019, 11:12:17 AM »
Yes you can flash the firmware from the Arduino IDE, but you don't use a Hex file, you download all the source code from GitHub and then open the project in the IDE.

However before you try all that try this first.

Go to https://zadig.akeo.ie/ and download the Zadig 2.4 program.

It's just a single EXE, it doesn't need to install anything. Run the EXE. Plug in your Arduino to the computer. In Zadig go to the Options menu and select "List All Devices."

Then in the main drop-down box try to find your Arduino device. It may be listed as "FT232R USB UART" or who knows what else. If you can't identify it let me know what devices it does find and I'll see if I recognize one.

One you select your Arduino device, on the left side of the form it will show what driver is currently installed, and on the right side of the form it will give you an option to replace that driver. I would be interested to know what driver it says is currently installed, but after you make a note of that, select "libusb-win32 (version xxx)" from the list on the right and then click the Replace Driver button.

Now reboot, then try flashing again and see it if works.
 
NO SUPPORT THROUGH PM - Read why
Need a forum account? Read here
Open Panzer FAQs

*

Offline Wibbly

  • 43
    • View Profile
  • Wales, UK
Re: Testing TCB Firmware with Stock Arduino Mega
« Reply #57 on: October 19, 2019, 01:00:17 PM »
I already have this useful program.   ;D

The only device is

usb serial device

The driver was:

usbser (v10.0.17763.1)

Having updated the driver as suggested, the COM port box in the config was blank.

However, I just tried USB Serial (CDC) in desperation..and it worked. The firmware updated.

The radio readings are a bit glitchy but I am putting that down to the converter in the circuit.

Having now centered the sticks, and allocated ch3 to throttle, and ch1 to steering, with pins 28 and 29 hooked up to the signals from the esc's, I am getting no response. My radio is in Mode 1, so the throttle is right stick up, and steering right stick left/right.

Can I assume that the 28/29 pins remain the same for the drive motors regardless of which mode the radio is in?

There may yet be a blown tx/rx chip on the 2560, if the tx signals aren't getting through the Arduino. I won't know until the new board arrives.

PS - I downloaded the latest OP Config as well.
Been into 1/16 tanks for over 10 years.

*

Offline LukeZ

  • 980
    • View Profile
  • Edinburgh, Scotland
Re: Testing TCB Firmware with Stock Arduino Mega
« Reply #58 on: October 19, 2019, 01:24:47 PM »
Good, this sounded very much like a driver issue so I figured that would solve it.

Can I assume that the 28/29 pins remain the same for the drive motors regardless of which mode the radio is in?
Yes, that is correct. It doesn't care what mode your radio is in or what channel is what, so long as you map everything correctly in the Read Radio procedure. If you have the sticks correctly assigned to throttle and steering and you can see them moving in the correct direction when reading the radio, then you are good to go.

Most likely you are missing something very simple like the engine hasn't been started. Using Snoop is the best tool to debug this. Can you start the engine and see that reflected in Snoop? After the engine is started, when you move the throttle forward does Snoop say you are moving forward? (You can also use the red/green LEDs on the board to confirm that movement is being commanded, see here).

There may yet be a blown tx/rx chip on the 2560, if the tx signals aren't getting through the Arduino. I won't know until the new board arrives.
I'm not sure exactly what you mean here, if you can flash firmware and read the radio then tx/rx to the Arduino are working fine. Serial communications aren't used for driving the ESCs, those are servo outputs.

If you fry the ATmega2560 chip then it usually doesn't work at all, but in some cases it is possible to ruin isolated pins. However I haven't heard that you've done anything to damage the chip so far, sounds like you just had a Windows hangup with the USB driver.
NO SUPPORT THROUGH PM - Read why
Need a forum account? Read here
Open Panzer FAQs

*

Offline LukeZ

  • 980
    • View Profile
  • Edinburgh, Scotland
Re: Testing TCB Firmware with Stock Arduino Mega
« Reply #59 on: October 19, 2019, 01:40:28 PM »
The other thing I will add is that you don't need to flash new firmware unless an update has been released, and even then only if you need/want whatever new thing has been added in the latest release. Once you have a working firmware on the board, there is no need to update it.

When you do flash a new firmware it can erase all your prior saved settings. So it very well could be for example that you had engine start assigned to some switch but with the new firmware that has been removed and you need to re-create it.

You can always tell what settings the TCB thinks it has by connecting to OP Config and doing a read from device (green down arrow). Now look at the settings and especially the function triggers and see if they are what you expect. The same goes for your channel assignments. If they are not correct, you need to change them.

The way to avoid having to do this every time a new firmware is flashed is to save your settings to an OPZ file (in OP Config go to the File menu and select "Save Settings to File.")

Now if a firmware update does erase your settings, you just have to open that OPZ file (either double-click on it in Windows, or if OP Config is already go to the File menu and select "Import Settings.") Then write those settings to your TCB (using the blue up arrow).

But again, once you have your model working there is usually not a need to be re-flashing firmware. Of course you can always change the settings whenever you want, but that is just reading/writing to the device in OP Config, and does not involve flashing firmware.
NO SUPPORT THROUGH PM - Read why
Need a forum account? Read here
Open Panzer FAQs