Help please programming surface mounted picaxe chips

JPU

Senior Member
Hi

Thanks for looking. I am wondering how to go about programming surface mounted chps. I am making a PCB and Id like it to be as small as possible. I may make many of these PCBs and will be using the surface mounted 14M2 and surface mounted 18M2. Im not sure how to go about programming these very small chips as I don't want to have any components on the board which may affect the end size. eg resistors, pins, etc used to program the chips.

Is there a way to pre-program the chips before mounting them onto the PCBs. ie is there a commercial chip programmer for this size of chip available. Or can someone explain a method of programming these small chips. I have only ever used the large r size chips in the past and so I am new to the surface mouthed world.

Thank you.
 

edmunds

Senior Member
Dear @JPU,

What I have done in the past, is I have had test pads routed for SerIn, SerOut and, of course, GND. Then you can design another PCB with all the extra components you want and 'pongo pins' to match the test pads. Some guide pins through mounting holes or something similar would probably be a good idea. Now you only have to position your board on top of the test/programming board, press on it lightly and press F5 on your computer.

This would not take too much time, if producing low volume products and would actually be part of the deal anyway if some further semi-automated testing procedure of the functions of the board would be required.

Alternatively, there has been talk on this very forum, RevEd would burn your chips for a fee before shipping them to you. In my mind this would only work for a very simple solution as normally you would want to be able to update your product the the latest firmware. In theory, there is also BAS800 sold by RevEd, that would support burning your chips with assembler code, but as I understand it is partly supported in PE5 and not supported at all in PE6.

Good luck with your project,

Edmunds
 

rq3

Senior Member
I sell a low volume commercial product that uses a surface mount 20M2. The three resistors for the programming circuit are included on each board, and terminate at a very small connector also used to interface the board with the outside world (power, ground, sensors, switches, etc).

I had originally considered pre-programming the 20M2 before they were soldered onto the board, and I am very glad I did NOT do this! Even the simplest code is subject to improvement as time goes by, and having to remove the chip from the board just to re-program it would be problematic at best. Sockets for surface mount chips do exist, but the size and expense is much greater than the three resistors.

On a final note, the SerIn pin must never be allowed to float, so you will need the 10Kohm pulldown anyway, and once that is in place, the 22Kohm follows by default. A 180 ohm current limit on the Serout pin, while not stictly required, is good practice if there is any chance of the outside world trying to inject electrons into that pin on the final product
 

AllyCat

Senior Member
Hi,

+1 to the above posts. These days, no (sensible) large volume manufacturer would produce a PCB that couldn't be reprogrammed in some way. The PICaxe "programming" serial interface also can be very useful for testing and debugging.

"Pads" are the answer, or even spring-loaded pins onto the existing pads/tracks. You really need only one SMD resistor to pull-down the Serial Programming pin. Make that resistor 100k (or 1M or probably 10M) and the PICaxe will still be happy, but you can then connect an external programming interface (including the 10k and 22k) via the three pads/pins.

Cheers, Alan.
 

JPU

Senior Member
Hi All,

Thanks for your ideas and advice. I understand most of the information given but I don't understand how the picaxe can be programmed if a 10k pull down is in place. If the 10k and Picaxe is in place on the end product PCB and then I overlay a second PCB with spring loaded pins which make contact with pads on the end product PCB, then wont the "serial in" pin still be pulled down by the 10k resistor and this will prevent programming?
 

erco

Senior Member
Hi All,

Thanks for your ideas and advice. I understand most of the information given but I don't understand how the picaxe can be programmed if a 10k pull down is in place. If the 10k and Picaxe is in place on the end product PCB and then I overlay a second PCB with spring loaded pins which make contact with pads on the end product PCB, then wont the "serial in" pin still be pulled down by the 10k resistor and this will prevent programming?
Actually that 10K resistor is part of the standard download circuit, along with the 22K resistor to the programming header. The 10K pulldown is still required even without the 22K for normal operation.
 

srnet

Senior Member
Hi All,

Thanks for your ideas and advice. I understand most of the information given but I don't understand how the picaxe can be programmed if a 10k pull down is in place. If the 10k and Picaxe is in place on the end product PCB and then I overlay a second PCB with spring loaded pins which make contact with pads on the end product PCB, then wont the "serial in" pin still be pulled down by the 10k resistor and this will prevent programming?
Take a look at the download circuit, page 8 of manual 1.

The 10K resistor is meant to be left in place on the PCB, it does not affect programming.

Its far better to build your circuit complete with the download circuit, the 10K and 22K resistors on the PCB, I would be very surprised if you cannot fit in the 2 resistors somehow.
 

edmunds

Senior Member
On a second thought - how much space do two 0402 or 0201 resistors with a common node take compared to 18pin SOP? Do you have manual assembly in mind? Still, 0402 is no problem and 0201 is doable with good repeatability if you have to. Just some equipment and little practice. It sounds like the wrong issue to spend time on. I understand you want to avoid the connector - that is bulky. Test pads are your industry standard answer that normally works. There is so much space under the SOP, that you can easily route the traces under it and to the bottom of the board. Components on both sides of the board are also an option.

Edmunds
 
Last edited:

AllyCat

Senior Member
Hi,

If you put both the 10k and 22k on the PCB then you have a standard programming circuit and you just use the Pogo (as in pogo stick) pins instead of the 3.5mm jack plug/socket. IMHO what you should NOT do is use the "minimal" configuration and connect the programming input dierctly to ground (which would make programming impossible).

Actually, the 10k + 22k give a pull-down resistance of 32k, so you could certainly use a single pull-down of 33k, but I would go higher. The 22k was mainly intended to drop the relatively high voltages from "real RS232" COM ports, but most USB programming adapters deliver much less. So you could use a lower value than 22k in almost any modern external programming circuit.

I suspect that an external 22k, with 33k on the board would program correctly. But say 10k externally and 100k on the board will defintely work well.

Cheers, Alan.
 

Technical

Technical Support
Staff member
We recommend these. It's a one off investment to buy, but they work very reliably.

http://www.tag-connect.com/

For volume orders (500+) of the same chip we can also pre-program them for you. This is done by programming in your BASIC program at the same time as the PICAXE firmware.
 
Last edited:

rq3

Senior Member
Hi All,

Thanks for your ideas and advice. I understand most of the information given but I don't understand how the picaxe can be programmed if a 10k pull down is in place. If the 10k and Picaxe is in place on the end product PCB and then I overlay a second PCB with spring loaded pins which make contact with pads on the end product PCB, then wont the "serial in" pin still be pulled down by the 10k resistor and this will prevent programming?
The 10K resistor to ground from the serin pin guarantees that the pin will be at logic zero at all times, UNLESS a voltage source with enough current capability is used to inject a signal into the serin pin.

Assuming the voltage source is +5 volts, and the pin impedance is infinite, the voltage source needs to provide 0.0005 amps (1/2 milliamp) to raise the serin pin to a logic high. All of that current is going through the 10K resistor. The situation is actually more complex, since the serin pin does actually draw some current, and a logic high is less than 5 volts, but that's the general idea.

So what is the 22K resistor for? The serin pin on a picaxe (and many of the other pins, too), have internal diodes reverse biased to the supply, and to ground. Back in the day, serial communications were done with the common RS-232 standard, which could swing up to +/- 25 volts! This was a worse case scenario, +/-15 volts was more common, and +/- 5 volts is not unusual.

The 22K resistor assumes that the absolute worse case 25 volts is applied to the pin's resistor, and uses the internal picaxe diodes to "clip" the voltage to within a diode drop of the supply voltage or ground. The diodes have an absolute maximum current rating of 20 milliamps, so the 22K was a good "average" value to make the pin recognize a 5 volt signal, while also protecting the pin if it was presented with a 25 volt signal. The 22K and 10K resistors are NOT a voltage divider. The 22K is a current limiter to protect the pin's diodes, and the 10K is a logic pulldown so that the pin will not float after programming. If the pin floats high, the picaxe will reset and expect a new incoming program.

Since the serin pin impedance is very high, changing the values of these resistors will do almost nothing to reduce current consumption of the final circuit, except for the bief period when the picaxe is actually being programmed.

You could, technically, delete the 22K resistor, but you would have to be very, very sure that any later programming operations used an "RS-232" source equal to the supply voltage of the pickaxe, and did not swing negative (below ground).

Just to beat this horse to death, the suggested 180 ohm resistor on the SerOut pin works in series with the pin's intrinsic P and N channel resistance to also limit (to just barely safe levels) current into and out of the pin if it should be shorted to ground or connected to the positive supply while configured as active high or active low, respectively.
 

westaust55

Moderator
For the very few cases where I have not included the full programming circuit on board:
1. Some with only a 3-pin header to attach an AXE029 type circuit
2. Some where space was so limited (e.g. An SMD board intended for a PIC but I used a PICAXE and a small board mod
I have put a 100 kOhm resistor between the SerialIn pin and ground/0 Volts. That has proven to be totally adequate to ensure the SerialIn pin is not floating and has no impact on connecting an external AXE029 type circuit.
 

rq3

Senior Member
Hi,

+1 to the above posts. These days, no (sensible) large volume manufacturer would produce a PCB that couldn't be reprogrammed in some way. The PICaxe "programming" serial interface also can be very useful for testing and debugging.

"Pads" are the answer, or even spring-loaded pins onto the existing pads/tracks. You really need only one SMD resistor to pull-down the Serial Programming pin. Make that resistor 100k (or 1M or probably 10M) and the PICaxe will still be happy, but you can then connect an external programming interface (including the 10k and 22k) via the three pads/pins.

Cheers, Alan.
For the 20M2 Picaxe, the worst case maximum pin leakage current is 1000 nA (1 microamp) at a 5 volt supply over temperature. This means that the largest useable (most ohms) pulldown would be 4 mega-ohms (4,000,000) to maintain a valid logic level on a 5 volt supply. The internal weak pull-up function is orders of magnitude "stronger" than this, but in the wrong direction.

So. A standard value 3.3 Mohm (20% tolerance) pulldown on the serin pin would technically work, and would also make the pin very sensitive to external influences, like body static, causing the Picaxe to reset and expect a download. Personally, I'd stick with the recommended "strong" 10K pulldown on the Serin pin. It only sees pin leakage after the program is complete.
 

AllyCat

Senior Member
Hi,

Yes the "maximum" pin leakage is 1000 nA at 125 degrees C, but only 125nA at 85 degrees C. The actual input switching threshold is around 1.25 volts, so 10 M should be "good enough" up to 85 degrees C. That's why I said "probably 10M", on the basis that the OP wouldn't be designing his circuit to run hotter than that. :)

Also, the pin pull-down resistance is not 10 kohms, it's 10k + 22k in series, so using a single 33k resistor would be the same as the standard download circuit. The Microchip data sheets are notoriously pessimistic, so I'd be very happy to use 100 k on a "local" pin (i.e. one that doesn't have any connections going off to anywhere else) which we know is connecting only to a small pad.

Cheers, Alan.
 

rq3

Senior Member
Hi,

Yes the "maximum" pin leakage is 1000 nA at 125 degrees C, but only 125nA at 85 degrees C. The actual input switching threshold is around 1.25 volts, so 10 M should be "good enough" up to 85 degrees C. That's why I said "probably 10M", on the basis that the OP wouldn't be designing his circuit to run hotter than that. :)

Also, the pin pull-down resistance is not 10 kohms, it's 10k + 22k in series, so using a single 33k resistor would be the same as the standard download circuit. The Microchip data sheets are notoriously pessimistic, so I'd be very happy to use 100 k on a "local" pin (i.e. one that doesn't have any connections going off to anywhere else) which we know is connecting only to a small pad.

Cheers, Alan.
Alan, you're right on all counts. Except.... Me, I like to design to the worst case min/max analysis. This is crazy for the average hobbyist. Or is it? If the average hobbyist "pushes the limits" on component specs, and the circuit fails, can they understand what went wrong? Especially when the components involved take up the same space and cost the same, whether they are 10K or 10M resistors, and the downside of using the recommended value is nil, while the downside of using the "limit pusher" may be non-obvious, especially to the casual hobbyist.

Splitting hairs on the download circuit is pointless. I never rely on "notoriously pessimistic" datasheets for circuit design, since there is nothing but personal experience to base that judgement upon. The casual hobbyist doesn't have that experience. Having said that, I love your personal experience, since it adds to my personal experience!
Points taken, and assimilated. Please keep the points coming over the years!
 

AllyCat

Senior Member
Hi,

when the components involved take up the same space and cost the same, whether they are 10K or 10M resistors, and the downside of using the recommended value is nil,

Actually a 10M might cost more (so I wouldn't recommend that) and two resistors will cost more than one (not just financial cost). Also a single 10k pull-down resistor may prevent the chip being reliably programmed by the standard programming circuit connected externally (the classic "10k on the PICaxe side of the 22k" mistake, so frequent on this forum). But to go back to post #1 :


I may make many of these PCBs and ....I don't want to have any components on the board which may affect the end size. eg resistors, pins, etc used to program the chips.
The OP had a clear specification, but I think there was a unanimous response that grounding the programming pin is a "bad idea" (but not as bad as leaving it floating ;) ).

Perhaps the OP has been persuaded to add the two resistors of the normal programming circuit, in which case there need be no further discussion. But I take the view that "one (resistor) is nearer to zero than two". Actually the diffference is larger than might be expected because the two resistors require a connecting track and a pad, whilst the one resistor simply links two PICaxe pins. That introduces a further advantage that all three "probe" points are PICaxe pins, so other debug/programming connections are possible such as an ic test clip.

Therefore, if he chooses one resistor, what value should it be? Omitting the 22k from the standard programming circuit won't give any pull-down current at all (really bad), and replacing it with a short-circuit track/link to the 10k will increase the current (capability) by a factor of more than three. The "equivalent" of the normal programming circuit is a resistor of around 33k (i.e. 10k + 22k) between the programming pin and the earth pin.

That will very probably permit programming even via the 22k of a standard programming interface, connected externally. But at least two of us take the view that 100k is a more appropriate value to choose. The higher values that I quoted in braces earlier were intended more as an indicator that in practice there is a very large safety margin.

Cheers, Alan.
 

Jeremy Harris

Senior Member
FWIW, I always include the smallest versions of the programming resistors I can on every board I build. I stopped using the big 3.5mm jacks a long time ago, and now almost exclusively use a 3 pin header. I have a 3.5mm jack socket to 3 pin header leader lead that enables the AXE027 cable to be used.

More recently I had to make a very compact board and still fitted the two small resistors on board, but arranged to have three pads on 0.1" centres for a programming connection. I have made up a home made version of the Tag Connect, without the retaining lugs. I used three pogo pins glued into holes drilled into a bit of Delrin. With 0.6mm holes in the pads I found that the pogo pins self-centred when pushed down on the board, and it wasn't really very hard to hold them down in place against their internal springs for the duration of a download.

If using such a method for development, then I would definitely make a jig to hold the board, with pogo pins in exactly the right place, not only for the three programming connections but also for things like power and any other external connections. Having a "hands-free" method of making connections definitely makes life easier!
 

abenn

Senior Member
My solution to programming SMD PICAXEs is to install the standard programming circuit on the board with an SMD JST Micro socket to access it. The two SMD resistors and socket take up minimal space on the board. I have an adaptor lead to connect the regular progamming cable's plug to a JST Micro plug.
 

JPU

Senior Member
Thanks to everyone for their tips and ticks and for taking the time to write so many informative words. I have learned allot here and had some ideas which I can now put into practice.
 

hippy

Technical Support
Staff member
A standard value 3.3 Mohm (20% tolerance) pulldown on the serin pin would technically work, and would also make the pin very sensitive to external influences, like body static, causing the Picaxe to reset and expect a download. Personally, I'd stick with the recommended "strong" 10K pulldown on the Serin pin. It only sees pin leakage after the program is complete.
The AXE401 ( 28X2 Shield Base ) uses a pull-down on the Serial In pin because the download interface can be re-routed to HSERIN/HSEROUT which would leave the pin floating. We used a 100K for that as I recall we found anything larger became more prone to interference.

So the minimal circuit we would recommend is a pad connected to Serial In with a 100K to 0V.

It should be possible to connect an AXE027 directly to that pad or via 22K. Using an RS232 programming lead the 22K is essential. If using less than 100K for greater immunity to noise, that should work with a direct AXE027 connection or via a programming adapter using a logic gate buffer ...

Code:
                    .-----.-----o )-------------------.-- V+
                    |     |                           |
                    |     |               .--------.  |
RXD <---------------|-----|-----o )<------| SO  V+ |--'
                    |     |               |        |
            ___    |\    |\               |        |
TXD >---.--|___|---| >O--| >O---o )---.-->| SI  0V |--.
       .|.  22K    |/    |/          .|.  `--------'  |
       | |          |     |          | |              |
       |_| 10K      |     |          |_| 100K         |
        |           |     |           |               |
0V  >---^-----------^-----^-----o )---^---------------^-- 0V
One might need to add external diode clamps to V+ and 0V for the first logic gate input if the chip doesn't include those.
 

Goeytex

Senior Member
The 22K resistor is used to limit current so that the internal ESD diodes can do their job IF .... the input voltage exceeds Picaxe Vdd. If programming with an AXE027 (5.0V TTL) or with another TTL level Device the 22K resistor is actually not really needed. It is there in case RS232 Levels of +15V - 15V are used for programing.

When a 10K resistor is tied directly to the SERIN PIN a Voltage divider will be formed if the external programming circuit uses a 22K series resistor... and programing will likely fail as the Signal level will be way too low at about 1.5V.

Since I NEVER use RS232 Levels for Programming, with a board will no programming Port, I generally use a 47K pulldown Resistor to keep the Picaxe happy. If the chip is soldered to the board and needs reprogramming I use a 3M Test Clip to make the connections.

http://multimedia.3m.com/mws/media/509710O/3mtm-test-clips-accessories.pdf
 

wapo54001

Senior Member
I always put an extra pad on each trace next to connectors, plus three for programming near the chip. I then use generic spring-loaded pogo pins with through-hole solder termination and solder them to those pads on an extra PC board of the same design. Easy to have a bed-of-nails connector board with twenty or more connections for full testing and interfacing to outside devices without any soldering or terminal connections.
 
Top