go_away

Author Topic: A little trick for pin expansion.... (getting that UART or ISP pins back)  (Read 1642 times)

0 Members and 1 Guest are viewing this topic.

Offline TrickyNekroTopic starter

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,207
  • Helpful? 15
  • 1.6L Peugeot 307 tuner
Well, it is only a basics trick that came to my mind this night....
This trick is based on a electronic switch IC for both analog and digital signals.
The IC is the 4066 (you can also use the older pin compatible 4016 which has higher "ON" resistance)
The concept is simple:
We connect the ISP or UART signals (any Ardruino user here)  to the A channel of the IC.
Then we connect the B channel to any device we want ( especially that naughty pin consuming LCDs!!!)
All the C channels of the IC are connected together and then to the reset signal.
As the reset line is high (via the 10k resistor) the switch is closed so the A and B channels are connected
thus we have "talk" with any device connect to the B channels
When reset line is HOLD at ground the switch is open and we can not talk with the external device.
NOTE that the switch is open (no connection) as far as the C channel is HOLD to ground.




Special notes:
Ardruino uses a boot loader.... This means that every time reset is issued it runs first the boot loader...
The reset line is NOT hold to ground when programming so you gotta MODIFY the bootloader
to hold an extra pin to ground when programming and then disconnect the pin.
This pin is also supposed to be connect to +5V through a 10K to 4K7 resistor.
So this circuit is NOT recommended for inexperienced ardruino users...

At the other head, those who program with ISP will find this circuit very useful cause it saves some extra pins
for other uses.
Simply all the C channels of 4066 are connected to the reset pin and MOSI, MISO, CLK to the A channels separately.
At the B channel they can connect anything that comes in handy in the respective pins (An A channel is interconnected to a perspective B channel)
NOTE that if you weren't using any resistor on the reset pin as pull up resistor, now it's required.
Although modern ISP programmers doesn't seem to have problems with devices connected to the ISP pins
it's been times I had much of a problem.... So the circuit is recommended...


Hope, I've been of help and not a headache...
Best Regards, Lefteris
Greece
« Last Edit: December 26, 2008, 06:22:06 PM by TrickyNekro »
For whom the interrupts toll...


P.S. I've been inactive for almost a year... Don't give promises but I'll try to complete my tutorials. I'll let you know when..

Cheers!

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
Re: A little trick for pin expansion.... (getting that UART or ISP pins back)
« Reply #1 on: December 26, 2008, 07:44:48 PM »
Interesting...
At first I thought you use this device to switch communication between different serial devices... But then I got your point. Here is how I solved the ISP problem:

I had the PWM1 and PWM2 pins connected to a motor driver. These pins share the ISP function, so every time I used a hardware programmer (STK200) the motors were twitching. instead of disconnecting the motors or the motor driver, I used a jumper to the power pin of the motor driver. When I was programming, I removed the jumper so the motor driver would not drive the motors.

Recently I started to use the Arduino software and I also have a serial LCD connected to the Tx pin of the microcontroller. The LCD will display garbage during sketch download, but other than that nothing bad happens. Also a jumper to the power pin of the LCD can solve the problem.
Check out the uBotino robot controller!

Offline TrickyNekroTopic starter

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,207
  • Helpful? 15
  • 1.6L Peugeot 307 tuner
Re: A little trick for pin expansion.... (getting that UART or ISP pins back)
« Reply #2 on: December 26, 2008, 07:56:21 PM »
To tell you the truth, I was introduced to that trick too...

It is generally a solution if you hate jumpers and all that stuff (I'm really forgetting stuff and this annoys me!!!)
It is clearly an electronic solution without the need of external interference...

I had problems with LCDs and all that stuff back at the Stone Age ( JDM programmer  :P )
With STK500 I forgot about it at all....
But, after buying that darn STK600, I was reintroduced to the problem when I connected a GLCD to the ISP bus
( I used PORTB as the data port)

So I though it might be of some good use to post this here...  ;D
For whom the interrupts toll...


P.S. I've been inactive for almost a year... Don't give promises but I'll try to complete my tutorials. I'll let you know when..

Cheers!

 


Get Your Ad Here