USB programming with a 3V3 peripheral (RFM22B)

Go To Last Post
22 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I built up this project http://www.ulrichradig.de/ and RFM22 und ein ATmega and after some time trying to get them to work I suddenly realised a potential gotcha.

Even though I am running my ATmega88 off a 3V3 supply I didn't stop and think what happened when I programmed the system. My USB programmer, via the ISP places 5Volts on the RFM22B (max 3.6V)!

It appears that the intention is to program this board via the ISP, so how does one safely program the ATmega88 while this 3V3 peripheral is attached?

Are there ISP programmers with 3V3 output or should I just disconnect the RFM22B while programming?

Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Some programmers, like the Atmel AVR ISP mkII, use the Vtg pin on the 6-pin programming header/cable to read the target board's operating voltage, and set its programming level appropriately.

If you connect to a 5V board, it programs with 5v levels. If you connect to a 3V board, it uses 3v logic levels.

Note that the programmer itself is powered off the USB cable, but the output level is dependent upon the target's operating voltage.

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK on the mkII behaviour, unfortunately the USB programmer I use is not that smart. Also, I am in the habit of removing the board supply voltage while I ISP it.

Looks like the best plan is to buy a mkII.

Thanks again,
davef

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Also, I am in the habit of removing the board supply voltage while I ISP it.

Just to note that won't work with the AVRISPmkII - it does not power the target - it just senses the level the target is being powered at then adapts its own signals to match. A programmer that is going to handle both 3.3V and 5V target kind of has to be like this though sometimes it's simply a manual selection with a jumper - perhaps the one you've built could be modified in such a way?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Buy a $3 Chinese USBASP.

The LcSoft ones have a 5V/3.3V/NC jumper.
The Betemcu.cn ones have a solder-bridge to achieve the same result.

Quite honestly, I would either buy one LcSoft or buy two Betemcu.cn boards and use one for 3.3V.

Of course a $35 AVRISP-2 will be fully supported by both Atmel and third-party software.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,
I bought USBasp programmer http://www.aliexpress.com/store/...

I assume that this one that I have to solder-bridge as davi.prentice mentioned.
(Issue 1)
when I connect attiny13 or other chip and plug USBasp to the computer the led that's indicates that's programmer is powered turning OFF(pull GND pin from chip, led turning on). (should it do that? or this is caused by unabridged pins?
(issue 2)
Receiving sck period error message and as I found out that I have to upgrade firmware with another programmer. (same cause or just have to upgrade firmware?).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You don't need to do anything. The Chinese firmware adjusts the SCK frequency automagically.

It comes out of the box supplying 5V.
Edit.
You remove the 0R resistor for supplying 3.3V.
There is no option for 'no power'.

Quite honestly, it is the easiest way to power a 3.3V board.

If you have a problem, say what you want to do.

I tend to use my own firmware. But I have a virgin betemcu.cn board that I can test.

Incidentally, I see that your board cost $4.29.
You can buy them a lot cheaper. However, I note that yours has a plastic case.

David.

Last Edited: Thu. Apr 17, 2014 - 09:49 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm learning at the moment no specific projects.
This slowing learning process since my USBasp doesn't work and for me it's not so easy to fix it since I'm a noob :)
according to ATtiny13 data sheet it's powered by 5V and

Quote:

The Chinese firmware adjusts the SCK frequency automagically.

I should be able to upload some simple code like blinking lights.
link to video (not great quality:( )
https://www.dropbox.com/s/0mig66...
Sounds like when I connect GND device is unplugged.
Device manager confirms it.
Some photos with connections
https://www.dropbox.com/s/kv3ll7...
https://www.dropbox.com/s/vzkgty...
I don't know but maybe I should do something about thous pins and not grounded USB male socket?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I should not worry about the grounded USB socket.

I would worry about connecting wires individually to a breadboard. Make or buy a proper ISP header that fits on your breadboard. Hint. solder some angled-male header strip.

Then you have a reliable 10-way ribbon connecting USBASP and AVR.

And of course, you should connect the right AVR pins to the ISP header.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Before connecting USBasp to the PC I checked connections between the ATtiny legs and USBasp. yes it's not good way to connect AVR chip but should it drop connection like this? Please comment on the USBasp disconnection. (what could lead to that (despise the way of connection)
Also thanks for such quick reply :)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Connect the AVR to the USBASP properly.

Then plug the USBASP into the PC.
The USBASP will enumerate (go ker-plunk)
Then it will be fully operational. The orange LED lights.

e.g. type:

avrdude -c usbasp -p ATtiny85

The red LED lights briefly (when the USBASP is active)
avrdude replies:
1. whinge about SCK period.
2. that it has read your Signature.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@clawson,
I bought a USBtinyISP v2 with buffered I/O, which would require leaving target power applied. My previous programmer, actually a USBtinyISP v1, was designed for only 5V systems.
Dave

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The USBtiny is very tight for Flash space. I suppose you could substitute an ATtiny4313.

In practice, most boards work at either 5V or 3.3V.
So the powered by programmer strategy works ok for most people.

I would agree that a voltage-sensing buffer is the 'best' way for 1.8V - 5.5V boards. i.e. never supply power.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't understand what

Quote:
The USBtiny is very tight for Flash space
has to do with being able to program other chips.

The ATmega88 works nicely at 5V or 3V3 but 3V3 peripherals connected to the SPI, when the ATmega88 is powered from 5V may not. One of the RFM22Bs appears to be non-functional after my mistake.

Quote:
i.e. never supply power
I assume means ... never supply power from the USB port itself.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The original USBTiny firmware required using an obsolete WinAVR to compile.

I know that I have made USBTiny compile on current GCC toolchains within 2048 bytes. But it is scary to think that any modification is likely to exceed the Tiny2313's flash space.

Of course, the current firmware (built with WinAVR-2006) works ok. So you probably have no desire to change it. Hence the flash space is irrelevant.

Quote:
I assume means ... never supply power from the USB port itself.

Yes. e.g. like the AVRISP-2 but unlike the STK500 whose 10-pin header is used.

I find it convenient to power a 3.3V target directly from the USBASP header. I don't think that there are any USBTINY schematics that offer 3.3V "powering".

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you for the clarifications. The USBtinyISP board I have does not offer 3V3 powering, so I'll just set it up to use the target power (3V3). That way I should not put any stress on the RFM22Bs!

Cheers,
Dave

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

david.prentice wrote:
Connect the AVR to the USBASP properly.

Then plug the USBASP into the PC.
The USBASP will enumerate (go ker-plunk)
Then it will be fully operational. The orange LED lights.

e.g. type:

avrdude -c usbasp -p ATtiny85

The red LED lights briefly (when the USBASP is active)
avrdude replies:
1. whinge about SCK period.
2. that it has read your Signature.

David.


Ok So I bought and solder connectors and now looks OK.
I found instructions how to update firmware
http://www.nexuscyber.com/boards...
"d. Short JP2 on the USBasp"
but I don't know which pins I shouls short in my USBasp.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You have NO need to upgrade any firmware. The betemcu.cn board works just fine.

However, you do need to connect all 6 ISP pins of the AVR to the correct pins on the 10-way header. Most importantly, you need to identify pin #1. i.e. the red stripe on the ribbon cable.

Note that there are several GND connections. You only need one (pin#10)

Seriously, that is all that there is to it. You should find photos on the internet. Arduino sites are good for diagrams. They probably use the 6-pin ISP pinout rather than the 10-pin ISP that you have.

You could post your own photo.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

david.prentice wrote:

You have NO need to upgrade any firmware. The betemcu.cn board works just fine.

David.

I receiving warning massage: cannot set sck period.
avrdude asks to check update firmware.
photo of USBasp connections
https://www.dropbox.com/s/o9b80r...

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There you are. Perfect comms !

This proves that you have connected all 6 wires correctly. You have a healthy ATtiny13 chip. The USBASP has adjusted to the best SCK speed.

Congratulations on a neatly wired and annotated photo. I wish everyone was as good as you. Especially when you use different coloured wires.

Only suggestion is: Connect 100nF capacitors close to the VCC and GND pins.

Oh, I would forget about the Tiny13. Choose a mega328 or mega324 for your general purpose projects.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have chips to try out but sins Yesterday my solder ran out I can't complete other sockets until Tuesday:(
What does is mean "can't set sck period"?
Can I upload sketches even if sck period is not set?
would it work as it should?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The original USBASP firmware had a SLOW jumper to use a slow SCK frequency..
Later USBASP firmware understand the -B# switch to change SCK period.
Chinese USBASP firmware detects the 'best' SCK speed automatically. It ignores the 'set sck' command from avrdude.

So you can ignore the message too. The Chinese firmware is 'better' than the German !

Yes, your sketches will upload just fine.

David.