PPM tester on ATTiny85 problems

Arduino projects on the go
bluejets
Posts: 316
Joined: 19 Jun 2019, 04:09

PPM tester on ATTiny85 problems

Post by bluejets »

I have been trying to load Martin's code for the PPM Tester that runs on Attiny85-20.

Using the same ATTiny module as shown in your descriptions above.

Using the Arduino IDE set to USBasp as programmer, ATTiny microcontrollers ATTiny 25/45/85 set to 85 and clock at internal 16mhz and your program adaptor as described here.
Only difference is I had one with the 10 pin lead so I added a 10 pin socket to the board, chased up a pinout diagram and wired it accordingly.

All compiles ok but I can't upload.
Problem is I get this error code when I try to upload using ....Sketch...upload using programmer.

Any thoughts where i'm going wrong?

Code: Select all

Arduino: 1.8.9 (Windows 7), Board: "ATtiny25/45/85, ATtiny85, Internal 16 MHz"

Sketch uses 6616 bytes (80%) of program storage space. Maximum is 8192 bytes.
Global variables use 204 bytes (39%) of dynamic memory, leaving 308 bytes for local variables. Maximum is 512 bytes.
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: error: program enable: target doesn't answer. 1 
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

the selected serial port 
 does not exist or your board is not connected

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

MaxZ
Posts: 330
Joined: 31 Jan 2019, 11:48
Location: Boskoop, Netherlands

PPM tester on ATTiny85 problems

Post by MaxZ »

Have you used "Sketch > Upload with programmer" from the menu? The arrow icon in the top-left corner of the sketch window will not do it.
bluejets
Posts: 316
Joined: 19 Jun 2019, 04:09

PPM tester on ATTiny85 problems

Post by bluejets »

MaxZ wrote: 19 Jun 2019, 07:07 Have you used "Sketch > Upload with programmer" from the menu? The arrow icon in the top-left corner of the sketch window will not do it.
Yes, I did say that in my query.

Problem is I get this error code when I try to upload using ....Sketch...upload using programmer.

Finally managed to get it to upload however I am still unsure of where the problem actually was.
I searched Google and read many opinions based around similar upload problems and one in particular mentioned the use of the 16mhz internal as being a possible source.

I modded a BLINK sketch to work with pin 1 output as opposed to onBoardLed and with the same hardware, I tried 1mhz as was suggested, then increased it to 8mhz and then finally again the 16mhz and although there were still 2 error messages relating to SCK problems, the sketches there on blink seemed to work fine.

So went back again to Martins sketch, loaded that up and again, with the 2 errors about SCK problem, the whole shebang worked fine.
Tried again on another (mini usb digispark) board and again, worked fine.

So I'm still none the wiser as to what was actually going on but hey, works now and I appreciate the help.
MaxZ
Posts: 330
Joined: 31 Jan 2019, 11:48
Location: Boskoop, Netherlands

PPM tester on ATTiny85 problems

Post by MaxZ »

bluejets wrote: 19 Jun 2019, 11:48 Yes, I did say that in my query.
Sorry, missed that.
bluejets wrote: 19 Jun 2019, 11:48... and although there were still 2 error messages relating to SCK problems, the sketches there on blink seemed to work fine.
The SCK warnings have been reported in several threads, including one of mine, where I was describing my hurdles in ICSP programming. They should be ignored.

Could it be a simple case of bad contacts? I have built the adapter but did not use it in anger yet. Test fitting a Digispark showed at least one dodgy connection (the reset pin), so it seems you really have to crank it a bit by stuffing some foam underneath to ensure good contacts.

Cheers,
Max.
User avatar
Phil_G
Posts: 597
Joined: 15 Feb 2018, 23:32
Contact:

PPM tester on ATTiny85 problems

Post by Phil_G »

Hi 'Bluejets' & welcome to the forum. Could you please post a brief intro in the Welcome section, we're a friendly bunch and we like to be on first-name terms Image
bluejets wrote: 19 Jun 2019, 11:48 Finally managed to get it to upload however I am still unsure of where the problem actually was.
I searched Google and read many opinions based around similar upload problems and one in particular mentioned the use of the 16mhz internal as being a possible source.
16mhz via the PLL is a perfectly valid option, in fact the one we use most often, its not generally a source of problems... Image
bluejets wrote: 19 Jun 2019, 11:48I modded a BLINK sketch to work with pin 1 output as opposed to onBoardLed and with the same hardware, I tried 1mhz as was suggested, then increased it to 8mhz and then finally again the 16mhz and although there were still 2 error messages relating to SCK problems, the sketches there on blink seemed to work fine.
The clock speed settings in the IDE have no effect on the clock, they're only there to tell the compiler what factors to use for delays etc. Programming a 16mhz chip with the IDE set to 1mhz will only result in delays being 1/16 their expected value. One exception is the 'Burn Bootloader' option which does affect the clock, setting it to 16mhz PLL (or whatever you selected) whilst actually not burning a bootloader!
bluejets wrote: 19 Jun 2019, 11:48So went back again to Martins sketch, loaded that up and again, with the 2 errors about SCK problem, the whole shebang worked fine.
You can ignore the SCK warning, some usbasps have manually adjustable sck and some dont, they set it automagically. The avrdude command to upload a program includes a 'set clock period' specifically for 'older', manual, usbasps. When a modern, 'automatic' usbasp sees the 'set' command from avrdude it returns this warning, its not an error and can be ignored.
MaxZ wrote: 19 Jun 2019, 12:20Could it be a simple case of bad contacts? I have built the adapter but did not use it in anger yet. Test fitting a Digispark showed at least one dodgy connection (the reset pin), so it seems you really have to crank it a bit by stuffing some foam underneath to ensure good contacts.
This is very true - if you're simply sliding the DigiSpark onto a row of header pins, its essential to put some pressure on to ensure every pin connects. My 'test' sparks have soldered header sockets for this reason :D

Hope this helps, bluejets please say hello in the 'Welcome' section Image

Cheers
Phil
bluejets
Posts: 316
Joined: 19 Jun 2019, 04:09

Re: PPM tester on ATTiny85 problems

Post by bluejets »

Hi Phil_G
Yes I did think that having the digispark board just sitting on the pins might not be the greatest as far as contact goes.

I did manage to hold the module with an amount of pressure against the pins which seemed to work.

Just reading your reply now I take it that you had used machine pins rather than the elcheapo square header pins.

Thought about the foam rubber comment I saw earlier and at the time the penny didn't drop, sort of a bit confused as to what the difference would be at the time.

What I have done is made up an adaptor that will allow an Arduino pro mini as ISP, put an 8 pin socket on the board for the dil versions and ordered both an ic clamp and one of the spring loaded adaptors for the surface mount version. Either will then plug in to the 8 pin socket.

I've used the USBasp programmers before on some ignition systems we used to play with and they were a bit touch and go there also but one managed to fumble through ok.

Anyhow, thanks for the input, I'll keep it all in mind
cheers Jorgo

ps...threw my hat in the door at the welcome part ;)

Edit:- Martins code called for the 16mhz setting and that was why I used it that way.
use the ATtiny85 capable of running at 20MHz (20PU). Burn bootloader to operate on internal clock at 16 MHz
bluejets
Posts: 316
Joined: 19 Jun 2019, 04:09

Re: PPM tester on ATTiny85 problems

Post by bluejets »

Still having problems I'm afraid.

As I said previously, the program loaded ok with just the 2 warnings so I assumed all ok.

Hooked everything up and all powers up nicely, the display showed the start screen with "PPM Tester
by Ceptimus and below that "No Signal" which was as I expected.

Tried with PPM inputs from several sources, a modified 9X receiver with PPM out didn't show any change so hooked up a scope and could see the pulses there.
Hooked the PPM Tester then to the PPM signal from a Tx I built but nothing there either.
I Know the latter works for sure as I have a receiver which shows stick position via NRF24 link.

Changed the ATtiny board to a different unit (one with the mini usb ) but still the same thing.

Next step is to re-program the first Attiny using an Arduino as programmer.
Failing that I'll go to the Arduino version and see if I have any luck there.

Edit:- No change with the reprogram so went to the Arduino version.
Some problems there also although not exactly the same.
Screen readout would come up with some readings but would flash off again back to the start screen.

Eventually stripped everything back to bare minimum and voila...... Had to be a common problem ( can't really say what) with a small piece of verboard I had used as a "terminal strip".

Had power the SDA and SCL lines and the incoming lead from the PPM signal with the cap and resistor also mounted there. Checked and double checked but everything seemed to meter out ok.
It's gone now so .....done.
I might go back and try with the ATtiny just to convince myself.

Did notice though, with the incoming lead now floating inside the box with the cap and resistor soldered there with a bit of heatshrink for insulation, if you happen to place ones finger and thumb over the exterior, the readout goes wacko ....no signal input but 8 channels of numbers start appearing n the display around the 49 mark.
Don't intend to do that on a regular basis, just that my thinking is perhaps the some stray capacitive effect from the vero board chucked it out of wack.
Martin
Posts: 744
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

Re: PPM tester on ATTiny85 problems

Post by Martin »

Make sure you have pull-up resistors (anything from 1K up to 10K seems to work) on the SDA and SCL lines. You're supposed to always fit them to any I2C interface, although it seems that often, you can be lucky and the sketch will run without them.

When you 'burn bootloader' on an AtTiny, it doesn't really burn a bootloader (there isn't one) but it does set the chip to run at whatever speed you've selected and whether or not to use an external crystal, etc.

If the speed is wrong, it's possible that the sketch will ignore a valid PPM signal - because the PPM signal would then (from the chip's point of view) be at a much higher frequency.

I would first 'burn bootloader' to set the chip to use a 16MHz internal oscillator. Then, as a check that it's running at the right speed, upload a simple 'blink' sketch that turns on an output for one second, off for one second, and repeat. Watch the output and verify that the sketch is indeed running at the intended rate. Make sure that whenever you upload a sketch, the Arduino IDE is set to use the internal oscillator at 16MHz - that way the IDE will compile the sketch to run at the same speed that the chip is operating on.

You don't really need the capacitor and resistor in line with the PPM signal in most instances. I put it there in my design in case people connected up the signal reversed (ground and signal swapped) or for those few radios that might give out a PPM signal at voltage levels that could harm an Atmel chip. Most radios it's fine just to connect direct to the input, and the voltage levels and impedances are such that the Atmel chip's internal protection diodes are sufficient to prevent damage.
bluejets
Posts: 316
Joined: 19 Jun 2019, 04:09

Re: PPM tester on ATTiny85 problems

Post by bluejets »

Hi Martin,
Fairly certain the Oled has pullups on board but I will check. I see somewhere it is R6 and R7.

Already did the burn bootloader as I read it needs to be done at any time the frequency is changed to reset the fuse. I did that at 16mhz internal and then loaded the program.

Yes, I did see the difference running a modded blink sketch at the different frequencies.

I'll get back to it again in the next couple of days but for now i have one running on an Arduino Promini.

Thanks for the reply ...Jorgo.
Stewart
Posts: 37
Joined: 17 Feb 2018, 04:57

Re: PPM tester on ATTiny85 problems

Post by Stewart »

Try restarting your PC then download a fresh copy of the digispark sketch , sometimes downloads get corrupted.
Post Reply