How do I get the SX28 chip to run without the SX-Key?
uptonryan
Posts: 28
Probably an easy ·question,
How do I get the SX28 chip to run without the SX-Key?
Ryan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ryan Upton
How do I get the SX28 chip to run without the SX-Key?
Ryan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ryan Upton
Comments
In my projects I tend to use a 50MHz resonator (you can get them from Parallax).
My progra headers look like this is there any difference?
DEVICE ··SX28, OSCXT2, TURBO, STACKX, OPTIONX
FREQ ··50_000_000
ID ··"Servo"
Ryan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ryan Upton
Apparently
OSCHS2 High speed crystal/res., 1MHz…50MHz *
OSCHS1 High speed crystal/res., 1MHz…50MHz *
OSCXT2 Normal crystal/res., 1MHz…24MHz *
OSCXT1 Normal crystal/res., 32kHz…10MHz *
OSCLP2 Low power crystal/res., 32kHz…1MHz *
OSCLP1 Low power crystal/resonator, 32kHz *
OSCRC External RC circuit
OSC4MHZ Specifies internal oscillator @ 4MHz
OSC1MHZ Specifies internal oscillator @ 1 MHz
OSC128KHZ Specifies internal oscillator @ 128 kHz
OSC32KHZ Specifies internal oscillator @ 32 kHz
I think this should help
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ryan Upton
It works with 4 MHZ and key connected and wide flat resonator and OSCXT2.
When I remove the key it doesn't work
When I set it to internal resomator "OSC4MHZ" it doesn't work with or without key.
When I try the other resonator it doesn't work with or without key.
When I set it to 50MHz and "OSCHS1" it doesn't work with or without key on either resononator.
Ryan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ryan Upton
'
' File: servoworking.sxb
' Purpose : To control the Pololu 8 servo control and corresponding servos
' Author : Ryan Upton
' Company : Upton Robotics pty ltd
' E-mail : adslpuay@tpg.com.au
' Started : 22 / 03 / 09
' Updated : 22 / 03 / 09
'
'
' Program Description
'
'
' This program talks to pololu 8 servo controller via pin 3 of the SX28 chip
'
' Device Settings
'
'OSCXT2 externl 4
'OSCHS2, exteernal 50
'OSC4MHZ
DEVICE SX28, OSCHS1, TURBO, STACKX, OPTIONX
FREQ 50_000_000
ID "Servo"
'
' IO Pins
'
SOut PIN RA.3 OUTPUT ' output to pololu
'
' Constants
'
Baud CON "T57600" '"T57600"
Sync CON $80 'Pololu Synchronisation value
PDEv CON $01 'Pololu Device
Cmd0 CON $00 'Pololu Command 0 Set Range and direction
Cmd1 CON $01 'Pololu Command 1 Set Speed
Cmd2 CON $02 'Pololu Command 2 Set Position 1 data byte
Cmd3 CON $03 'Pololu Command 3 Set Position 2 data byte
Cmd4 CON $04 'Pololu Command 4 Set Position Absolute
Cmd5 CON $05 'Pololu Command 5 Set Neutral
Ser0 CON $00 'Servo 0
Ser1 CON $01 'Servo 1
Ser2 CON $02 'Servo 2
Ser3 CON $03 'Servo 3
Ser4 CON $04 'Servo 4
Ser5 CON $05 'Servo 5
Ser6 CON $06 'Servo 6
Ser7 CON $07 'Servo 7
'
' Variables
'
idx VAR Byte ' loop counter
tmpB1 VAR Byte ' temporay byte 1
tmpB2 VAR Byte ' temporay byte 2
tmpTX VAR Byte ' transmit byte
tmpW1 VAR Word
' =========================================================================
PROGRAM Start
' =========================================================================
'
' Subroutine Declarations
'
SET_SERVO_SPEED_TO_FAST SUB 0
RESET_POLOLU SUB 0
SET_SERVO_RANGE_DIRECTION SUB 0
MOVE_SERVO SUB 2
DELAY_MS SUB 1, 2 ' delay in milliseconds
TX_BYTE SUB 1 ' transmit a byte
'
' Program Code
'
Start:
'Reset
'RESET_POLOLU
'set servo speed to fast
SET_SERVO_SPEED_TO_FAST
'set range and direction
SET_SERVO_RANGE_DIRECTION
DO
FOR idx = 0 To 1
READ Move_Servo_Byte1 + idx , tmpB1
READ Move_Servo_Byte2 + idx , tmpB2
MOVE_SERVO tmpB1, tmpB2
NEXT
LOOP
'
' Subroutines
'
'reset
SUB RESET_POLOLU
TX_BYTE Sync 'set pos servo 0
TX_BYTE Cmd2 'set pos servo 0
TX_BYTE $00 'set pos servo 0
ENDSUB
'set servo speed to fast
SUB SET_SERVO_SPEED_TO_FAST
TX_BYTE Sync 'synchronization value
TX_BYTE PDEv 'pololu device
TX_BYTE Cmd1 'cmd to set speed
TX_BYTE Ser0 'servo 0
TX_BYTE $00 'set pos servo 0
DELAY_MS 2000
ENDSUB
'set range and direction
SUB SET_SERVO_RANGE_DIRECTION
TX_BYTE Sync 'synchronization value
TX_BYTE PDEv 'pololu device
TX_BYTE Cmd0 'cmd 0 set range and direction
TX_BYTE Ser0 'servo 0
TX_BYTE %01011110 'set range 30
DELAY_MS 2000
ENDSUB
'move servo
SUB MOVE_SERVO
TX_BYTE Sync 'synchronization value
TX_BYTE PDEv 'pololu device
TX_BYTE Cmd3 'cmd 3 set Position 2 Data bytes
TX_BYTE Ser0 'servo 0
TX_BYTE tmpB1 'data1
TX_BYTE tmpB2 'data2
DELAY_MS 2000
ENDSUB
'Delay
SUB DELAY_MS
IF __PARAMCNT = 1 THEN
tmpW1 = __PARAM1 ' save byte value
ELSE
tmpW1 = __WPARAM12 ' save word value
ENDIF
PAUSE tmpW1
ENDSUB
' Transmit a byte
SUB TX_BYTE
tmpTX = __PARAM1
SEROUT SOut, Baud, tmpTX
ENDSUB
'pg101
'set neutral
'serout SOut, Baud,Sync 'synchronization value
'serout SOut, Baud,PDEv 'pololu device
'serout SOut, Baud,Cmd5 'cmd
'serout SOut, Baud,Ser0 'servo
'serout SOut, Baud,$1E 'data1 neutral 3000
'serout SOut, Baud,$00 'data2 neutral
'PAUSE 2000
'set absolute position
'serout SOut, Baud,Sync 'synchronization value
'serout SOut, Baud,PDEv 'pololu device
'serout SOut, Baud,Cmd4 'cmd 4 set postion absolute
'serout SOut, Baud,Ser0 'servo 0
'serout SOut, Baud,$00 'data1
'serout SOut, Baud,$00 'data2
'PAUSE 2000
'mini SSC II Mode
'serout SOut, Baud,$FF 'set pos servo 0
'serout SOut, Baud,$00 'set pos servo 0
'serout SOut, Baud,$FE 'set pos servo 0
'
' User Data
'
'360 degrees
'Move_Servo_Byte1:
'DATA $00 '0
'DATA $7F '2
'Move_Servo_Byte2:
'DATA $01 '1
'DATA $70 '3
'180 degrees
Move_Servo_Byte1:
DATA $00 '0
DATA $00 '2
Move_Servo_Byte2:
DATA $01 '1
DATA $70 '3
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ryan Upton
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Thomas Talbot, MD
Gunpowder, MD, USA
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ryan Upton
Are you re-programming it using the Run->Program option before removing the SX-Key? This is also done using the keystrokes CTRL-P.
If you have simply programmed it for debug and then remove the SX-Key, the project will not run, as the SX-Key is expected to supply the clock and interact with the SX chip.
Thanks,
PeterM
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ryan Upton
It could be that the removal of the usb cable drops the power supply to the SX Tech Tool Kit and so affects the shape of the bnits goping across to the pololu chip somehow.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ryan Upton
Have you done any other projects with the SX chip to confirm your setup it working? The SX processors are pretty robust chips and shouldn't be this much trouble to get working.
To check out your SX28 to see if it is running without the SX-Key attached I would make a tiny program to blink an LED and program that into the chip. Just add an LED and current limiting resistor on one of the unused pins. If you use SX/B you should be able to try the different clock settings and if you use the PAUSE to define the delay it should work the same no mater what frequency you select. A short example is in the SX/B help file under PAUSE
Flash:
DO
LOW RC.0
PAUSE 1000
HIGH RC.0
PAUSE 1000
LOOP
If the LED blinks then you know the processor is working and that your clock is working too. As someone mentioned make sure you program the chip before removing the key otherwise it will leave some of the debugging code in the chip. If this doesn't work then we'll need to troubleshoot your setup to see where the issue is. Once that is resolved then we can see about moving on and getting it to work with your servo controller.
Robert
Post Edited (RobotWorkshop) : 4/16/2009 4:05:24 PM GMT
Great suggestion. I followerd it using the code below.
DO
MOVE_Mini
TOGGLE Led
PAUSE 100
LOOP
Where MOVE_MINI sends commands to the pololu to move the servo back and forth.
When I Connect it to the PC via SXKey and USB the servo motors works and the LED blinks.
When I disconnect the sxkey and usb the LED still blinks but the servo motors stop.
I think this proves the fault is with the pololu chip or more precisely the connection between the pololu chip and SXKit. The polulu chip may be drawing cxurrent from the SXTech kit via the connection somehow and when the powered usb is disconnected this changes the signal from the sxkit to the pololu enough for the pololu to stop working.
I brought and oscilliscope today and hopefully when hook that up that should tell me what the waveform looks like. I was thinking if I connect a 100pf cap and 100 ohm resitor in series across the pololu logic input and pololu ground that may clean up the signal. I may also twist wires together to stop them acting like antennas.
What do you think?
Ryan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ryan Upton
BTW, for 50MHz I tend to use OSCHS2, have found other settings (with the resonators I use) don't work well.
I really should wire this properly. Any suggestions?
Here is a picture of setup dodgy as it is (but working)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ryan Upton
Post Edited (uptonryan) : 4/16/2009 4:45:35 PM GMT
The USB SX-Key is powered from the USB port so it shouldn't be causing any power issues. On a side note, the orginal SX-Key (Serial based) required that your target system supplied 5V to power the SX-Key. Since you are using the USB version I doubt the SX-Key is causing any power related problems.
It's cool that you were able to add the LED which confirms that the SX28 is indeed up and running. Now it is a matter of troubleshooting the connection to the polou servo controller. There are some other questions I have about your setup.
- How are you powering the polou servo controller? Is it powered from your SX-board so they share the same logic supply?
- Are the SERVO's connected to the logic supply or do they have their own power source? Servo's can draw quite a bit of power and need an adequate power source with good filtering or it may interfere with the operation of the CPU.
- How is the connection done between the SX28 and the servo controller? Is it a direct logic level connection or is there anything inline? You mention adding a cap to the serial line but I don't see where you would need that. How about pull-up/pulldown resistors?
- In regards to the servo controller does that have a fixed baud rate or does it 'auto-detect' the incoming data? If it auto-detects perhaps it is making a mistake.
Robert
>How are you powering the polou servo controller? Is it powered from your SX-board so they share the same logic supply?
Originally the pololu and sxtech board ground seperately with 7.5V 1amp for the sx and lab power supply for pololu. I then connected the ground of both those boards (but the Vdd is still seperate) and now it all works.
So there are three power supplies, one for pololu one for sx and one for servos.
>- Are the SERVO's connected to the logic supply or do they have their own power source? Servo's can draw quite a bit of power and need an adequate power source with good filtering or it may interfere with the operation of the CPU.
Servos have a seperate power supply
- How is the connection done between the SX28 and the servo controller? Is it a direct logic level connection or is there anything inline? You mention adding a cap to the serial line but I don't see where you would need that. How about pull-up/pulldown resistors?
I just ran hookup wire from pin 3 of the SX28 to logic in of the pololu controller. At one stage I had pull up resistors and an led to check coms.
- In regards to the servo controller does that have a fixed baud rate or does it 'auto-detect' the incoming data? If it auto-detects perhaps it is making a mistake.
I thought this as well. The pololu has an auto-detect. But it is confusing,It may fix it permanently once it detects it, but this is something that is not clear from the pololu manual or from experimentation. At the moment it seams fixed on 57,600 baud for one mode and 9600 for another mode.
Eventually I want all this to run from the same power supply. I have brought some capacitors to act as reseviours to do this.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ryan Upton