sd21 servo controller not downloading

Hi

I am having trouble downloading my test pogram. The error shows the normal issues eg no power, hardware not connected etc:

I think I have completed everything be the book. Using the 18x with code that I cut and paste

sorry for the blurry picture. I completely remade the serial plug board when the first error message came up using all new components, however error messages are the same.

the picaxe has 5v and the test servo is holding its position

'***************************
'* SD21 example code *
'* with picaxe 18x *
'***************************

i2cslave $C2,i2cfast,i2cbyte ' Join i2c with SD21

main: i2cwrite 63,(255) ' Set servo 1 to 255
pause 500
i2cwrite 63,(128) ' Set servo 1 to 128
pause 500
i2cwrite 63,(0) ' Set servo 1 to 0
pause 500
i2cwrite 63,(128) ' set servo 1 to 128
pause 500
goto main



Any ideas?
 

Attachments

BeanieBots

Moderator
Can't really make out much from the picture!

It looks like your little board includes the download circuit resistors?
Doesn't the servo board also have a download circuit?
If yes, there will be potential divider action and the download won't work.
 

hippy

Technical Support
Staff member
Yes, no resistors required at all. The wiring is shown in the AXE031.PDF for the 21 channel servo driver, page 3.

Note it's the outside legs of each pair you need to use, though just as easy to solder the two legs of each pair together.
 

MartinM57

Moderator
Outside pins only are fine - it's when you only use the inside pins that you get (big) trouble

Best to use both, as the Manual does, and not have to remember which way round is correct.
 
hi

I removed the external resisitors and still no luck
I have added another picture how it is now
Any ideas? This is new to me and I could even have the picaxe in backwards, but I dont think so. The coded is a cut and paste from the manual


Also I have clearer better pictures but am unable to upload due to the size of the file. What is the simplest way to reduce the data size without reducing the quality?

regards
michael
 

Attachments

hi

I removed the external resisitors and still no luck
I have added another picture how it is now
Any ideas? This is new to me and I could even have the picaxe in backwards, but I dont think so. The coded is a cut and paste from the manual


Also I have clearer better pictures but am unable to upload due to the size of the file. What is the simplest way to reduce the data size without reducing the quality?

regards
michael
 
whoops, after having another look at it, I realized that I had the Rx and Tx around the wrong way .

I soldered the 2 sets of pins together to aliviate that as a problem, swithed the Rx and Tx to their correct positions and tried it again, and bummer, still the same hardware problem

awaiting next idea

regards
michael
 

russbow

Senior Member
Probably not part of this issue, but I think it important to note the picaxe programming circuit in the SD21 datasheet shows the pin side. the picaxe manuals show the "top" side. Not really apparent at a quick glance.
 
Last edited:

lbenson

Senior Member
>What is the simplest way to reduce the data size without reducing the quality?

In Windows, the "paint" program allows you to crop and, under "Image", to resize. There would be loss of resolution, but if the original photo is sharp, it should not matter.
 
thanks for the info on reducing file sizes. the picture shows the serial plug without the resistors, however with the tx and rx the wrong way around

Where in the manual is the led test for the sd21 board?

regards
michael
 

Attachments

i noticed that the Tx pin in the brochure that came with the board is the one on the end. On the robot UK site in the examples, the Tx pin is the second pin, this is the image I uploaded on my first post.

Anyway, I still could not download. I took the 18x out and put it on a breadboard and managed to download a program to flash on and off an LED. It worked. Then I downloaded the sd21 test program, that worked. I than placed the chip back into the board and powered it up, and that worked. I then added another servo and downloaded to it and that worked.

My question is, when a chip is new, should a small test program be used prior to check it?

can someone send me some program that will run various servos, one at a time with speed also controlled.


regards
michael
 

hippy

Technical Support
Staff member
@ michael : The AXE031.PDF shows TX at the end nearest the screw terminals; TX ( out to PC ), RX ( in from PC ), Attn ( not used ), Gnd (0V).

Looking at the PCB photo on page 2 that seems to match with the description, the two surface mount resistors to RX, one to 0V. You can check by using a meter to do a continuity check to the PICAXE pins.

@ tiscando : Yes, i2cwrite is the same as writei2c, also i2cread is the same as readi2c.
 
hi

this link shows the Tx as the second pin (i think). this is where i got the picture from in my first post.

http://www.robot-electronics.co.uk/htm/picaxe_examples.htm#SD21 Servo Controller

using a multimeter i figured ot the download circuit on the sd21 board and realized that the tx had to be the first pin because it had continuity between it and the serial in pin on the 18x. I also noticed the sd21 uses a 28k resistor when our manual uses a 22.

I still havent found any example programming to show how it moves the servos with speed variations. Can someone help me here
 

hippy

Technical Support
Staff member
Discrepencies and errors in documentation can occur so it's always worth continuity checking where tracks go to make sure what you have matches how it's described.

The 28K shouldn't be a problem. An odd value, but likely 27K +/- some tolerance.
 
ok, now I watch the servo moving back and forth as per the sample program. Can someone show me the change in the sample program to change the speed of the servo

regards
michael



'***************************
'* SD21 example code *
'* with picaxe 18x *
'***************************

i2cslave $C2,i2cfast,i2cbyte ' Join i2c with SD21

main: i2cwrite 63,(255) ' Set servo 1 to 255
pause 500
i2cwrite 63,(128) ' Set servo 1 to 128
pause 500
i2cwrite 63,(0) ' Set servo 1 to 0
pause 500
i2cwrite 63,(128) ' set servo 1 to 128
pause 500
goto main
 

BeanieBots

Moderator
So what was the downloading problem?

I've never used the SD21 myself so this is only a guess based on what I've read on page 7 of the SD21 manual.

Have you tried writing different values into register 0 (servo 1 speed register)?

What does this code do? (I'm only guessing, but it's what I'd try)
Code:
i2cslave $C2,i2cfast,i2cbyte
main:
  i2cwrite 0,(250)
  i2cwrite 63,(225) 
  pause 2000
  i2cwrite 0,(10)
  i2cwrite 63,(75) 
  pause 2000
goto main
 
after being frustrated with it not working, i thought back to basics. I removed the 18x and put it on the breadboard and set it up to flash a LED ( just to check if the chip was ok)

I did notice that when I powered up the chip, the led came on, strange I thought that it was in its high state. I then downloaded the simple flashing program and it worked. I then replaced the chip back into the sd21 and downloaded the test program as above, and behold, it also worked.

My technical conclusion is that it was "stuck"

regards
michael

ps; I am not near my contraction at the moment, but will try the modified program asap
 

Marcwolf

Senior Member
Hmm.. I'm running an 20X2 and I have noticed that the SD21 can be touchy re the IC2 Speed

i2cslave $C2,i2cfast,i2cbyte I use this i2cslave $C2,i2cslow,i2cbyte

and it seems to be happier.

Hope this helps. I am currently looking at several servo's all happily moving around using commands on a SD-Ram card.

Take Care
Dave
 
I managed to get it working, thanks for all your posts. I would never have got this far without the forums help

This is what I ended up with. The first part was to work out the limits of the crane (grapper, lift and slew).

The second bit is an attempt to attach a switch and the third part is the looped program


i2cslave $C2, i2cslow, i2cbyte ' Join i2c with SD21

' grabber (servo 1)
'i2cwrite 0,(10) ' speed opening (1 to 16)
'i2cwrite 63,(225) ' Set servo 1 to 255 (full open 225)
'pause 3000
'i2cwrite 0,(10) ' speed closing
'i2cwrite 63,(70) ' closed 70
'pause 3000


' lift (servo 3)lower number adds height
'i2cwrite 6,(10) ' speed opening (1 to 16)
'i2cwrite 65,(60) ' Set servo 1 to 255
'pause 3000



' slew (servo 2)

'main:i2cwrite 3,(5) ' speed

'i2cwrite 64,(10) ' slew anticlockwise

'pause 4000

'i2cwrite 3,(5) ' slew clockwise

'i2cwrite 64,(145)

'pause 4000



2.



main:

label_2:

if pin0 = 1 then label_7 'Decision command

goto label_2



label_7:

high 1

high 4

low 1

low 4

goto label_2



















3.



main:



i2cwrite 6,(10) ' lift (servo 3)lower number adds height

i2cwrite 65,(60) ' start position



i2cwrite 3,(5) ' slew (servo 2)

i2cwrite 64,(145) ' start position





i2cwrite 0,(10) ' grabber (servo 1) open position

i2cwrite 63,(225) ' start position



i2cwrite 3,(5) ' slew anticlockwise

i2cwrite 64,(10)

pause 4000



i2cwrite 6,(5) ' lower arm

i2cwrite 65,( 130)

pause 3000



i2cwrite 0,(10) ' grabber closing

i2cwrite 63,(70)

pause 3000





i2cwrite 6,(5) ' lift arm

i2cwrite 65,(60)

pause 3000





i2cwrite 3,(5) ' slew clockwise

i2cwrite 64,(145)

pause 4000





i2cwrite 0,(10) ' open grabber

i2cwrite 63,(225)

pause 3000



goto main

My next question is how to activate a servo sequence from a high input. There are 2 seperate servo sequences operated by 2 seperate inputs

Any ideas

regards

michael
 

tiscando

Senior Member

Michael, you should enclose code in [code] and [/code] tags:


[code]
main:
label_2:
if pin0 = 1 then label_7 'Decision command
goto label_2
[/code]


Which will be:
Code:
main:
label_2:
if pin0 = 1 then label_7 'Decision command
goto label_2
This will have made your post neater.


(info: I used [noparse] tags to prevent the above [code] tags, for demonstration, from parsing)
 
Last edited:
Another problem that I have is that the program runs fine while the stereo serial plug is connected and the computer running.

When I turn the computer off or pull out the serial plug the program loops. If I plug it in again and turn on the computer, the crane stops at its correct position.



I am guessing an earth/ ground fault. What does everybody else think?

The servos are powered by a seperate 6v plugpack (no earth). Another 12v plugpack (no earth)powers the picaxe and sd21 board via a 5v regulator









main:
if pin0 = 1 then crane 'Jump to crane if pin0 is high
if pin1 = 1 then teabag 'Jump to teabag if pin1 is high
goto main

crane:
i2cslave $C2,i2cslow,i2cbyte ' Join i2c with SD21
i2cwrite 6,(10) ' lift (servo 3)lower number adds height
i2cwrite 65,(60) ' start position
i2cwrite 3,(5) ' slew (servo 2)
i2cwrite 64,(145) ' start position
i2cwrite 0,(10) ' grabber (servo 1) open position
i2cwrite 63,(225) ' start position
i2cwrite 3,(5) ' slew anticlockwise
i2cwrite 64,(10)
pause 4000
i2cwrite 6,(5) ' lower arm
i2cwrite 65,( 130)
pause 3000
i2cwrite 0,(10) ' grabber closing
i2cwrite 63,(70)
pause 3000
i2cwrite 6,(5) ' lift arm
i2cwrite 65,(60)
pause 3000
i2cwrite 3,(5) ' slew clockwise
i2cwrite 64,(145)
pause 4000
i2cwrite 0,(10) ' open grabber
i2cwrite 63,(225)
pause 3000
goto main

teabag:
i2cslave $C2,i2cslow,i2cbyte ' Join i2c with SD21
i2cwrite 9,(10) ' servo 4 speed opening (1 to 16)
i2cwrite 66,(190) ' start position, closed (1 to 255)
pause 3000
i2cwrite 9,(10) ' speed closing
i2cwrite 66,(75) ' max open position
pause 3000
goto main



This I think looks a bit neater

regards
Michael
 

Janne

Senior Member
Is the 10k pulldown resistor in the download circuit reliably soldered? If the resistor was mounted poorly, that would cause the serin pin to float when the download cable is removed, causing the program not to run.
 

MartinM57

Moderator
It's best not to turn on/off the computer with the programming lead connected - some people report problems with the PICAXE appearing to go/actually going into "download" mode when the PC port changes as the computer powers on/off.

But if the PICAXE freezes just when the programming cable is removed you probably have a circuit fault.

To aid understanding what is happening, put something like

#terminal 9600
pause 250
sertxd ("started....")
pause 100

at the start of your program so that you can see when the program restarts itself (press F8 to get the terminal window at any time)
 
Thanks for the quick replies

The SD21 board has the download resistors already mounted on them. The only connection I had to make was the stereo plug.

There are some other strange things happening within the whole project. I am pretty sure that they relate to power problems.

What size capacitor should I solder across a small motor to illiminate interference?

I will try that code when I get a chance

here is the sd21 part of the project
http://www.youtube.com/watch?v=oPUkO93n0bU

thanks again
michael
 
I figured out why the servos would run when they should not have after pulling out the stereo plug.

The inputs are floating. Using a 10K resistor on eack input to grd fixed the problem

Thanks for all the replies
 
Top