Need help with Speakjet project conversion

Hey gents,

I have been trying to get my AtomPRO28 to communicate to my Speakjet and it seems close but no cigar. It randomly outputs sounds mixed in with sounds read from my code. If I try a new baud number, it does other things. Some baud settings cause the buffer to stay full while other settings allows some flow control. Im almost certain the baud rate is my only problem with the code.

Here is the code I am using:


baud    con    2400 ; <------- not the actual number used
'------------------------------ SpeakJet Setup ]-------------------------------------

SEROUT 9,baud,"\0RX"] 'CLEAR BUFFER
SEROUT TX\RDY,baud,[020,127]' set volume to max
SEROUT 9,baud,[PITCH,85,BEND,4]


'------------------------- Prases ]--------------------------------------------------

ph1:
'My name is Vecter
SEROUT TX\RDY, baud,[MM,OHIH,PA1,NE,EYIY,MM,PA2,IH,IH,SE,SE,PA2,VV,VV,EH_,KO,TT,RR,RR,PA2]
pause 10

goto ph1

Mike, are these MM,OHIH,PA1,NE,EYIY,MM,PA2,IH,IH,SE,SE,PA2,VV,VV,EH_,KO,TT,RR,RR,PA2 constants that are defined somewhere?
Wouldn’t the baud need to be something like N2400?

Yeah, I should have mentioned that those letter pairs are defined constants. I left them out because there are so many and not real important to the question. When I programmed the SpeakJet for the basic stamp, the baud used was $0054, but this does not work with the Basic Atom PRO because of the speed difference.

I looked at sample code for the Parallax MCU’s and they used conditional compile settings that set the baud rate based on what MCU was detected.

#SELECT $stamp
  #CASE BS2, BS2E, BS2PE
    T2400       CON     396
    T4800       CON     188
    T9600       CON     84
    T19K2       CON     32
  #CASE BS2SX, BS2P
    T2400       CON     1021
    T4800       CON     500
    T9600       CON     240
    T19K2       CON     110
#ENDSELECT

Inverted        CON     $4000
Baud            CON     T9600 + Inverted

I have tried all of the following but nothing worked.

just asking because it would be simple to overlook but did you set the baud rate in the chip already? I am assuming you have tested it with something else and it works. If that is the case then it seems like baud rate and format is not something that should need to be adjusted, i.e. its a known qty from whatever you tested the speakjet with, no?

I don’t quite get why you are trying to figure out what numerical value to pass for baud when you can just use one of the predefined labels. the whole point behind the labels is to abstract the specific hardware so you don’t have to figure out the value, and that is what the conditional assembly code segment you pasted is doing.

here is a simple test to determine if the polarity of the serial output is correct. just send the first string to the speak jet and then have the program sit in an endless loop. the serial line going to the speakjet should be logic high. if its not then you need to use one of the inverted baud modes and test again. when the serial port has been initialized and the serial line is sitting idle it should be in the high state. that’s how you determine N9600 vs I9600 is the proper polarity setting for the serout command. (this all seems obvious but I’m just suggesting a test so you are not just assuming it is all working correctly.)

now, if you have to, just re-program the baud rate for the speak jet from the bap. looking at the version 1 data sheet for the speakjet it seems like it would be pretty simple. just write your bap program to send any character at the desired baud rate and wait for a button press (this initializes the serial port with a serout command), put the speakjet in baud configure mode, tap the button on the abb so it will send the 0x55 and then die (loop endlessly.)

at this point whatever baud rate is actually coming out of the BAP will be the rate the speakjet is programmed to accept. make a chunk of code to spit the command to say “ready” which if I read the datasheet right is the string “\0VX”. if it does that then you know it can receive characters correctly. I don’t think I would even be messing with the handshake yet, just send it real simple 3 or 4 byte commands to establish it’s working at all. once you have that then you can see about adding the handshake line or using the pace parameter on the serout line instead.

Man, I’m confused… :unamused:

The Speakjet worked fine with the Basic Stamp with all settings left as they were. The only changes I had to make were pin definitions and add an underscore " _ " to some of the letter pairs as some seemed to be reserved for the BAP.

It did send serial data but what comes out of the SJ is random sounds.

I did want to try to set the SJ in auto baud mode and send it $55 but it was getting late and I was frustrated. To be honest I’m not sure how I am going to send $55 via code if the baud rate is not working properly… I know I am way off base but programming is not one of my strengths.

You can put the SJ (speakjet) in self-test/demo mode, which I did and it cycled through all sounds in memory with no problems, so it is working.

I’m thinking I might be connecting it to the BAP wrong? Polarity is right cause I tried it both ways, but I am using the data cable supplied with the SSC-32 as the serial cable for the SJ The narrow connector is connected to the SJ board’s D0 and RTX pins and the wider connector is connected to the BAP’s pins #4 and #6. The reason a pin is skipped is because the 3-pin connector uses the two outer pins with the middle pin being a NC.

The SJ is factory set to use 9600 baud per the data sheets and I was on the Basic Micro forums and one person said he was able to communicate with the BAP using a baud rate of 9600.

Do I need a pull-up possibly?

I’ll try to take pictures of my setup today.

EDIT**

I was reading Jims tutorial for the basic stamp 2 and think I will give this a shot to see what happends.

lynxmotion.com/images/html/build027.htm

I guess it might help to stand back and ask all of the obvious simple questions to try to eliminate any obvious problems.

  1. How is the Speakerjet hooked up to the ABB board. I assume you have to have at least two wires. The communication pin and probably a ground pin? Later in your code I see that it has a second input pin RDY. Power pins connecting the two? If so is the pin on the ABB configured for the right voltage?

  2. On your ABB board - which pins are connected? I see you mention 4-6, but your code is refering to pin 9. So are your two pins P9 and P11?

  3. What baud rate do you expect the SJ to receive? Does it want any particular parity? Your first code example looks like you want 2400, but later you said that on the BP you sent a $54 on the BAP, so I am now assuming 9600. You did not mention anything about parity, I am assuming none, but could be even parity. So I would try several of the combinations…

  4. I am not sure in your code where some of the Serouts go to pin 9 and others have flow control and I do not see where the pins TX\RDY are defined.


baud    con    N9600
;baud    con    I9600
;baud    con    NE9600
;baud    con    IE9600

SJPin    con     P9
RDY      con    P11

'------------------------------ SpeakJet Setup ]------------------------------------- 

SEROUT SJPin,baud,"\0RX"] 'CLEAR BUFFER 
SEROUT SJPin\RDY,baud,[020,127]' set volume to max 
SEROUT SJPin,baud,[PITCH,85,BEND,4] 


'------------------------- Prases ]-------------------------------------------------- 

ph1: 
'My name is Vecter 
SEROUT SJPin\RDY, baud,[MM,OHIH,PA1,NE,EYIY,MM,PA2,IH,IH,SE,SE,PA2,VV,VV,EH_,KO,TT,RR,RR,PA2] 
pause 10 

goto ph1 

Assuming the pins and baud rate of 9600 are correct, I would try compiling with each of the baud defines I had above and see if any of them work.

Kurt

Thanks kurte,

1.) I do have several descrepencies. I am using Pins 4 and 6 on the ABB because the 3 pin connector of the data cable is using the outer two pins with the middle pin not being used (skipped). I fexed the pin 9 problem but it did not help anything.

2.) The SpeakJet Board I am using is custom made. I’m using one data pin and one flow control pin.

3.) The SJ manual said the chip is factory set to use 9600 baud, No parity, so I need to use this baud rate. Question: do I send this as $0054 or T9600, or … ???

4.) I am powering the SJ board using the ABB’s power connector. I cant remeber the lable of the power connector since I am at work working off my memory.

5.) Currently no resistor is being used.

6.) I have not tried using a one wire configuration yet to see what would happen. As for the 1k resistor, I am trying to figure out if it is in series with the data line or is it a pull-up?

Mike, you need to DL or print the BAP manual. Many of the commands are the same as the stamps, but the serout baudmode has a totally different format.

serout 9,i9600,[MM,OHIH,PA1,NE,EYIY]

or

serout 9,n9600,[MM,OHIH,PA1,NE,EYIY]

Hope this helps.

Thanks Jim,

I did download the BAP manual and read it, but I guess I need to go back and read it again. :blush: :laughing:

We keep dancing around the baud rate question… what does the $0054 in your stamp code set for baud rate for the stamp?

In his earlier post, that had some BS2 defines the $54 would be T9600 (54 hex is 84). He shows Baud as defined there as T9600+Inverted.

SO my guess is I9600 on the BAP, but not sure what each consider inverted…

Swing your partner by the hand…1-2-3-4, 1-2-3-4… that was a fun dance :stuck_out_tongue:

Ah yes, the $0054 is 9600 baud for the basic stamp 2 that worked flawlessly with the SJ. so the below code woked with the BS2

serout 9, $0054, [data…]

That one line of code was all that was need to make the SJ speak, provided you did not use any constants and added the actual number values for the data to output.

When I get home today I have a lot of things to try to see what happens.

ok so if we can assume you have your pins connected correctly between the BAP+ABB and the SJ, we can assume this right Mike, then you only have two things to try which are I9600 and N9600. I think you should try this without any handshaking and using just a very simple command like “\0VX” to get it to say “Ready”. If that works then you’ll be ready to add handshaking so you can send it more than a couple bytes at a time. :wink:

Agree 100% at the very least, if it doesn’t work, then it means I have something else wrong. I will try sending “\0VX” that’s a good idea, it’s short and simple.

Should I use a resistor? and also, should it be in series or as a pull-up?

For the Basic Atom, 9600 is I8N1_9600, and for the Atom PRO it would be I9600. :smiley:

8-Dale

I can’t see off hand why you need a pull-up anywhere. Using the baud labels we’ve been discussing (I9600 and N9600) the serial outputs are driven totem-pole type outputs. Is there some reason you think you should need a pull-up or series resistor? Do you need one in your existing basic stamp setup?

Based off of Jim’s tutorial, it mentions a 1k resistor was used. My Parallax Homework board with the BS2 did not use a Pull-up. I have read in some cases, for reliable data, a pull-up resistor should be used. I’m not saying that I am correct, I just have a question regarding this because its sort of a gray area.

Meh, so use a pull-up resistor to 5V on the lines between the BAP and SJ. If they felt the need to include it in the tutorial they may have encountered a situation where it helped and it’s not likely to do any harm so just add it and cross it off the fret list. :wink:

I figured we could dance around the pull-up resistor topic a few more times… Ok Eddie, take my hand… you ready?

J/K :laughing: :stuck_out_tongue: