S/W & H/W to program DIYMORE board?

Arduino projects on the go
Post Reply
User avatar
drigotti
Posts: 54
Joined: 29 Aug 2018, 12:44
Location: Ohio USA

S/W & H/W to program DIYMORE board?

Post by drigotti »

What's everybody using to program their DIYMORE mini strong pro 5V board? I'm having Phil do my first purchase of this board already programmed. I'm looking to learn more. I "think" I've already revised the stock sketch Phil has provided to this group. I used the Arduino software to make the revised .ino sketch.
What hardware is needed to upload it?
Is there better software to use?
Some hand holding or easy to follow links?

Thanks SO MUCH!!!

Dave Rigotti
Last edited by drigotti on 04 Nov 2018, 00:35, edited 1 time in total.
Dave Rigotti
User avatar
Phil_G
Posts: 596
Joined: 15 Feb 2018, 23:32
Contact:

Re: S/W & H/W to program DIYMORE board?

Post by Phil_G »

There are two ways to program the boards Dave. The serial way, using a serial FTDI board which uses the internal bootloader program thats installed in nearly all arduino chips.

The bootloader runs on power up and waits for serial input - anything up to 5 seconds in some cases.
This is a Bad Thing. During this delay your board is doing nothing, its not producing PPM as your encoder
program doesnt run until the bootloader times out. Three reasons why this is bad:
1) All my encoders use 'power-up with stick thrown' for reversing. The bootloader delay means that by the time it passes control to your encoder, you may have tried a stick to check for servo movement, and so the encoder sees an unwanted 'reverse' command.
2) Powering-up some modules with no PPM present causes disastrous problems, Corona for example defaults to channel values way beyond the standard servo limits, which drives all the servos to the end stop and then strips the gearbox.
3) a transmitter that doesnt start transmitting until after some arbitrary delay is just a poor show. Say you catch your neck-strap and accidentally switch off during a flight. You notice and switch back on in time to save the day, but your transmitter doesnt start up until possibly 5 seconds later - definitely a Bad Thing.

The second way is to use a USBASP, this programs the chip directly via SPI.
With this method your encoder code runs immediately on switch-on, with none of the above problems,
and so is hugely preferable. Serial is ok for experimenting, but I would always suggest a USBASP and SPI.

There are many USBASPs listed on ebay, mostly 5v which is what we want, some also have 3.3v capability, some are 3.3v only, so check what you're buying. It connects to the 6-pin header on the Strong board.
Most of us dont actually fit a header, we just wedge one in temporarily whilst programming Image

Cheers
Phil
User avatar
drigotti
Posts: 54
Joined: 29 Aug 2018, 12:44
Location: Ohio USA

Re: S/W & H/W to program DIYMORE board?

Post by drigotti »

Phil,
The changes I'm making involve the usual options.... active toggles, Futaba/JR, pos/neg PPM.
I find it interesting, this programming stuff.
I'll continue to get the "real world" stuff from you already programmed!

Thanks for the lesson on programmers!

Dave Rigotti
Dave Rigotti
User avatar
drigotti
Posts: 54
Joined: 29 Aug 2018, 12:44
Location: Ohio USA

Re: S/W & H/W to program DIYMORE board?

Post by drigotti »

How's this look for a programmer?

https://www.ebay.com/itm/AVR-10-Pin-USB ... rk:20:pf:0

Do I use the Arduino software with it or does it require different software to upload sketches?

Thanks

Dave Rigotti
Dave Rigotti
Martin
Posts: 744
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

Re: S/W & H/W to program DIYMORE board?

Post by Martin »

Just use the regular Arduino IDE.

Under the Tools menu => Programmer, select USBasp.

To upload your program, instead of using the usual 'Upload' option or icon, use the 'Upload Using Programmer' option from the Sketch menu.

Depending on what operating system you are using, installing the drivers for the USBasp may be slightly tricky. You may not have to do anything so don't worry about it till you have a USBasp. If it doesn't work, and you're using Windows, there is a (free) program called Zadig that makes installing the USBasp drivers pretty easy. You only have to do it once anyhow.
User avatar
drigotti
Posts: 54
Joined: 29 Aug 2018, 12:44
Location: Ohio USA

Re: S/W & H/W to program DIYMORE board?

Post by drigotti »

Thanks Martin! I picked up one of these.....
I got the driver loaded no problems. Windows 7 64 bit.
I might go get a nano board to experiment with!
20181106_144331.jpg
Dave Rigotti
User avatar
Mike_K
Posts: 669
Joined: 16 Feb 2018, 06:35
Location: Hertfordshire

Re: S/W & H/W to program DIYMORE board?

Post by Mike_K »

Phil_G wrote: 04 Nov 2018, 12:05 The bootloader runs on power up and waits for serial input - anything up to 5 seconds in some cases.
This is a Bad Thing. During this delay your board is doing nothing, its not producing PPM as your encoder
program doesnt run until the bootloader times out.
Phil

This isn't the case with the Optiboot bootloader that comes pre-loaded onto Uno's. The Optiboot boots up within a few microsecond of a normal "power-on" as it includes the "no-wait" feature. This works by reading the "reset reason" from the AVR registers, and ONLY starting the bootloader for an "external reset", and NOT for "power up."

If you use an ISP programmer and don't set the fuses for "no bootlooder", it takes fractionally longer to boot than Optiboot as the reset vector will still point to where the bootloader would normally reside, and will execute 2K of NOP's.

The good news is that Optiboot can be installed on any Arduino board with an ATmega328P including the Nano, Pro Mini and any of the DIYMORE or STRONG boards (that I know you favour). And it is included with the Arduino IDE, so there's nothing to download or install.

The bad news is that you need to use an ISP programmer to install it, so you may think why bother? Well if you are writing/developing software for the Arduino, the standard way to debug is via the serial monitor (unless you have a JTAG programmer or similar) and once you are using the serial port for debugging you may as well program it though the standard USB interface for a Nano or an USB to serial for a Pro Mini. But if you are just installing a program then I agree there isn't so much point.

I wrote a few notes on how to install the Opti Bootloader which got uploaded onto this site a while back, it also includes how to set the fuses correctly if you're using an ISP programmer:

download/file.php?id=1225

Cheers

Mike
User avatar
Phil_G
Posts: 596
Joined: 15 Feb 2018, 23:32
Contact:

Re: S/W & H/W to program DIYMORE board?

Post by Phil_G »

It was just a general recommendation Mike, I know about Optiboot but all the usual ebay nanos and prominis I've seen come with the standard bootloader and its inherent boot delay. The 5-second culprit is the Digispark for which I've not seen an alternative bootloader, plus the Digispark bootloader is huge as it does bit-banged usb.
What I was trying to help Dave with is that with the standard bootloader as supplied on the nano/promini/strong/digispark boards that we tend to use most, the startup delay can (not necessarily will) cause the problems I listed Image
Cheers
Phil
User avatar
drigotti
Posts: 54
Joined: 29 Aug 2018, 12:44
Location: Ohio USA

Re: S/W & H/W to program DIYMORE board?

Post by drigotti »

Martin/all,
Installed the drivers. I programmed a nano with "blink". It worked!...Except I get an error message about "cannot set sck period" BUT it still blinked....
Thanks for the help!

Dave
Martin wrote: 04 Nov 2018, 16:52 Just use the regular Arduino IDE.

Under the Tools menu => Programmer, select USBasp.

To upload your program, instead of using the usual 'Upload' option or icon, use the 'Upload Using Programmer' option from the Sketch menu.

Depending on what operating system you are using, installing the drivers for the USBasp may be slightly tricky. You may not have to do anything so don't worry about it till you have a USBasp. If it doesn't work, and you're using Windows, there is a (free) program called Zadig that makes installing the USBasp drivers pretty easy. You only have to do it once anyhow.
Dave Rigotti
User avatar
drigotti
Posts: 54
Joined: 29 Aug 2018, 12:44
Location: Ohio USA

Re: S/W & H/W to program DIYMORE board?

Post by drigotti »

Thank you Phil!
Dave Rigotti
Post Reply