Serial1 max baud

What is the highest baud rate available on the Spark’s serial1?

I need 1Mbps for the smart servos I want to use.

Checking the STM32F103 datasheet makes me think one can do 4.5 Mbits, and the other can do 2.25 Mbits, but I’d want to double-check with the hardware guys to be sure.

You might consider that most smart servos (Dynamixel, Uptech, HerculeX) are capable of lower serial rates (once configured on another platform).
This can reduce MPU usage a lot.
I’m using dynamixels on an arduino myself and always had trouble with high baudrates in my sketch.

Mike43110, what smart servo’s are you using? I too am starting on working with the Spark core and Dynamixel AX-12A smart servo’s. If you too are using Dynamixel’s I was wondering what SDK you were going to use? I was using Dynamixel_Serial in the past written for Arduino’s. But am having issue trying to get it working/converted for use with Spark.

I am using the AX-12As as well :smile: I was actually going to just write my own from scratch, seeing as I could never get it working 100% on Arduino.
Though, now that you are around I can pick your brain! I could never get read working. Not even with a single servo without a buffer. That is why I was going to do it myself and try getting it right.

I used the library from Pablo Gindel
http://www.pablogindel.com/informacion/the-arduinodynamixel-resource-page/

Question: How have you connected the AX-12As? Did you connect them directly to the RX TX pins, without something converting it to 3.3V? I am not sure (Dave if you could confirm?) that the RX pin is happy with 5V being applied to it. I could be wrong but according to the pin mapping, RX and TX are not specified as 5V compliant.

kobaan, I most likely won't be involved in the usage, so if more servos are added, I don't want to have to worry about the bauds being set correctly. If I have to though I will set it nice and low.
Most likely testing will be done at 9600 anyway!

Glad to see that I am not the only one who is trying to use smart servos with the core!

I too had issues with the library that you are using, don’t remember exactly what though… But I had great success with this one: https://code.google.com/p/slide-33/downloads/detail?name=Dynamixel_Serial%20V2_2.zip&can=2&q=

And I don’t connect the servo’s directly to the tx/rx pins, I use a SN74LS241N chip because I have 12 servo’s connected in serial. See this page for further explanation: http://robottini.altervista.org/dynamixel-ax-12a-and-arduino-how-to-use-the-serial-port

Unfortunately the programming involved with the libraries is a “little” beyond my capability. While I am a programmer, I am more of a UI/Web developer… So the C++ firmware stuff is still new to me:) Please let me know what progress you make and I will do the same. Br, Jeff

I will have 18 :smiley:
Ok! I have that library as well, just never had success with it.
Will set up the circuit, with and without buffer and test the read every damn time and one of them will work! (please let it work)

Once I can confirm that it works on the Arduino I will start trying to port the library. I think though that there will be issues as the USART bus at 1Mbps and the current polling scheme do not mix well (If I am wrong, do tell)

If I can’t get the library working (though I can see now at least a decent confirmation that it does work) then I will just write from scratch anyway.

Well! At last I got the damn Dynamixels working properly!

Now to do the fun times of sorting out the library…

Will start work on it in the morning.

1 Like

good! did you get them working with the arduino using the https://code.google.com/p/slide-33/downloads/detail?name=Dynamixel_Serial%20V2_2.zip&can=2&q= library? You had mentioned the tri-state buffer chip that you had also used with the Arduino. I realized that the 74LS241N chip that i have (and you also might be using?) is rated for 4.7-5v, not 3.3. So it might now work with the Spark. But I just bought some SN75HVD12P 3.3V RS485 chips that I am hoping will work. I will let you know. But the good news is that I got the Library from the link above to compile with the exception of the UCSR0A register references. I already did another post for this so I am hoping someone will have a solution. I will let you know what I find out.

Yup!
I was having the same problem. The rest is easy, just use the Atmega32U4 code as we are using serial1.

Is what I am currently using to do level shifting.

I am not sure if there will be a single chip solution. However, the logic level shifter will most probably work.

I have just finished with the library now, I think. I will be testing tomorrow! Hopefully everything works 100%, If the level shifters work fine I will be VERY pleased as that makes my life a lot easier as I already have the level shifters!

This is causing the core to kind of lock up and not be able to flash again. have you had the same experience?

the 1st occurrence of it is in the setMode function of the Dynamixel library.

Anyone else have any ideas if this isn’t compatible with the core yet???

 while (Serial1.read() != -1);						// Clear RX buffer;

If there was nothing on the buffer before this started, am I right in thinking this would cause the core to read until something popped up on the buffer?

This clears the buffer.
The comment is "Clear RX Buffer"
So it reads until empty.

How did you diagnose that Spyke?
I am getting utterly NO response out of the core, so would be intrigued on how you found that line causing issues.

while (Serial1.available() != 0){ Serial1.read();}

Replace the line with that.
Its a bit ugly, 2 operations instead of 1.

The LED turns on!

Will test the ping operation next and make sure that that does work.
There is a define NONE that I changed and for wheel sync I changed ID1,ID2,ID3 to ID_1, ID_2, ID_3 to avoid clashes with other macros.

Ok, there seems to be an issue with my buffer circuit (again…) I get the wheel to turn successfully!
Going to see what is wrong now, probably something idiotic again on my part.

The problem is directly related to the direction pin… Not sure why though, am going to try using the direction pin without the level shifter ( and definitely moving it off D2 then!)

Hi Mike, yes thanks the while (Serial1.available() != 0){ Serial1.read();} worked fine! So my firmware compiles and gets to the Core fine and doesn’t lockup, etc. But now I am just having the problem that it basically doesn’t work. I bought a SN75HVD12P 3.3V RS485 buffer chip but am not sure if that is even working or if I have it wired up correctly. You had mentioned before that you hooked the Dynamixel directly to the core, how did you do that? I need to remove some factors to determine whether my problem is hardware or software. Can you please tell me how your setup is so I can try to copy and get mine working? Thanks!

Write works fine, read doesn’t work at all…
This weekend I will bandage it up and fix it.

I just used the same circuit as before with the level shifter I linked between the spark core and the buffer chip.

I can make the servos move, I can’t read their current positions. That will be attempted to be fixed over the weekend. That or porting the sensor library I need :smiley:

1 Like

Dude! I got the servo’s to finally move:) I had the buffer chip wired wrong… Try the SN75HVD12P TI RS-485 Interface IC, it basically does the same thing as the SN74LS241N, but only has 8 pins and operates at 3.3v! So no level shifter needed to use with the Spark and takes up way less space. Pin 1 - RX, Pin 2,3 - Enable/Disable control, Pin 4 - TX, Pin 5 - Gnd, Pin 6 - Servo Data, Pin 7 - Not used, Pin 8 - VCC(3.3v). Let me know what you figure out on the read as I will eventually need that functionality also. Thanks for all your help lately:)

2 Likes

Well, if it works I will look into it…

I need the space! There really isn’t much where the spark is to be mounted.

1 Like

High gays. I’m new in particle created an account just to give a help that I hope I can. So I used 2 have a broken dynamixel64r that I disassembled and found out the following: dynamixel64 has a processor stm32f103 connected to a 3.3 v regulator so data should be 3.3v . But guess what. The data coming from the the outside goes through a controlable buffer having 5v as vcc. That means stm32f103 pins are 3.3 v and 5volts tolerant. I took many pics showing the interconnections I may give next.