BasicMicroUK - Forums

www.basicmicro.co.uk
It is currently Tue Apr 24, 2018 1:29 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 37 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: ARC-32 SSC32 emulator code
PostPosted: Sat Aug 14, 2010 2:01 am 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 7:00 pm
Posts: 1316
Location: Temecula, CA
I've been working on code for the ARC-32 to run all the functions of the SSC 2.04 firmware. I've gotten most of the basic commands working. Parts that are not implemented yet:

Reading/Writing generic eeprom locations(reading and writing registers is fully implemented)
Latched Inputs(Regular input states are implemented).
Sequencer commands(gp or 2dof hex sequencer)

All other commands appear to work as they should I'm posting this to get feedback.


Attachments:
ssc32-emulator.bas [18.91 KiB]
Downloaded 723 times

_________________
Tech Support
Basic Micro - Robotic Technology Evolved
Top
 Profile  
 
 Post subject: Re: ARC-32 SSC32 emulator code
PostPosted: Sat Aug 14, 2010 2:09 am 
Offline
Master

Joined: Tue Jun 22, 2010 9:15 pm
Posts: 228
I'll try to take a look, seeing as I have a new ARC-32 to play with!

Thanks!

Alan

_________________
Visit:
http://groups.yahoo.com/group/SherlineCNC/
http://tech.groups.yahoo.com/group/HexapodRobotIK/


Top
 Profile  
 
 Post subject: Re: ARC-32 SSC32 emulator code
PostPosted: Sat Aug 14, 2010 2:26 am 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 7:00 pm
Posts: 1316
Location: Temecula, CA
Note that I set the hserial baudrate to 625000. The Studio terminal windows support this speed so you can play around with it. If you are planning on using any Lynxmotion software I beleive all of it is setup for 115200 or less. The ARC-32 can not produce 115200 serial using it's hardware UART(thanks Hitachi :( ). In that case you will need to use 38400 which is another standard SSC32 baudrate. Once I get everything from the 2.04GP firmware working on the ARC-32 I'm going to ask Jim at Lynxmotion to get his software updated to support the higher baudrates the ARC-32 can support.

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
 Post subject: Re: ARC-32 SSC32 emulator code
PostPosted: Sat Aug 14, 2010 4:23 am 
Offline
Master

Joined: Tue Jun 22, 2010 9:15 pm
Posts: 228
115K? Too bad! I use that speed a lot. Funny Hitachi would not make that available. Would a different XTAL help?

Alan KM6VV

_________________
Visit:
http://groups.yahoo.com/group/SherlineCNC/
http://tech.groups.yahoo.com/group/HexapodRobotIK/


Top
 Profile  
 
 Post subject: Re: ARC-32 SSC32 emulator code
PostPosted: Sat Aug 14, 2010 5:28 am 
Offline
Master

Joined: Tue Nov 21, 2006 5:34 pm
Posts: 662
I think it is true for a lot of microcontrollers who run at 16 or 20mhz don't do 115200 ver well. That is why if I remember correctly the SSC-32 runs at something like 14.7456mhz or the like. If you look at the charts you see that at this speed it can do all of the standard baud rates with 0% error. I have run into this with both the H8s as well as the Atmegas.

I believe that most Lynxmotion software can go faster, but it is in the standard baud rates, like (115200, 128000, 256000). This appears to be true for both SEQ as well as Lynxterm.

Sounds like something fun to play with!

Kurt


Top
 Profile  
 
 Post subject: Re: ARC-32 SSC32 emulator code
PostPosted: Sat Aug 14, 2010 3:56 pm 
Offline
Master

Joined: Tue Nov 21, 2006 5:34 pm
Posts: 662
As a follow up to last nights post, I have in the past tried to see if I could get a special version of the SSC-32 that would have a faster baud rate that we could directly talk to with processors running at 16 or 20mhz. When you try for example 115200 which works great at: 14,745,600

For Atmegas not running in double speed serial: 14745600/(16*115200)=8
Which translates to 0% error, however trying to run it at: 125000: = 7.3728 so closest baud is
131657 or about 5.3% error which will not work well

Now running H8s at 16mhz: Wont do math but 125000 is 0% error, likewise for 20mhz 0% error.
But if we try running at 115200 we do similar calculations from above, except must be multiples of 32 or 16000000/(32*115200) = 4.34 so use 4 which comes out to nearest baud rate of 125000 or something like %7.8 error. Likewise for 20mhz...

So the question is, is there a faster baud rate that can be chosen that works at all three clock speeds. If so I wish we could get MikeD to give us a version that maybe replaces the 2400 baud rate with it... Likewise see if we can get the PC software to run at those speeds as well as at the speeds like 125000, 250000. However I believe not all serial ports on a PC can handle non-standard baud rates...

Kurt


Top
 Profile  
 
 Post subject: Re: ARC-32 SSC32 emulator code
PostPosted: Sat Aug 14, 2010 5:48 pm 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 7:00 pm
Posts: 1316
Location: Temecula, CA
For PC users the FTDI chip can run at any baudrate so you can always use the 625000bps rate.

For microcontroller users attaching to the ARC32(not sure whos going to be doing that) the fastest standard baud rate is 57600. To calculate non-standard baudrates that can be used the formula is mhz/(32*n) where n is 1 to 255.

Non-Standard HBAUD rates
H625000
H312500
H208333
H156250
H125000
H104166
H89285
H78125
H69444
H62500

Standard HBAUD rates and there actual rate at 20mhz
H57600(actually is 56818 or 1.4% error)
H38400(actually is 39062 or 1.7% error)

Standard HBAUD rates and there actual rate at 16mhz
H57600(actually is 55555 or 3.4% error)
H38400(actually is 38462 or 0.2% error)

So on a 20mhz part 57600 is the fastest standard baudrate and on a 16mhz part 38400 is the fastest standard baudrate.

+-2.5% error is the maximum allowable error. Anything over that and you will almost certainly have data corruption. For example 78125 should be within error margin for 76800bps(1.7%).

Also I recalculated the errors for 57600 and 38400. On a 20mhz part H57600 will have a lower error than H38400. I also just tested it and it appears to work fine too.

It is preferable to use an exact supported baudrate but async serial was designed to allow an error margin in timings.

To understand how the 2.5% error margin is caluclated is pretty simple. You have 10 bits of serial data. 1 Start, 8 Data, 1 Stop. So 100%/10 = 10%. Half that error is for the transmitter and half for the receiver. So 10%/2 = 5%. Since you need error margin for being over or under the actual rate you have to divide the remaining error margin in half again. 5%/2 = 2.5%. Since the Start bit re-syncs the data stream you don't have to worry about multiple bytes when it comes to error margins.

This does assume a decent serial routine. A good serial device will wait for a start bit and then wait 1.5 bit widths so that the first data bit read is in the middle of the data bit(or very close to it).

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
 Post subject: Re: ARC-32 SSC32 emulator code
PostPosted: Sun Aug 15, 2010 6:07 am 
Offline
Master

Joined: Tue Jun 22, 2010 9:15 pm
Posts: 228
Seems we always had to choose xtals for good baud rate spreads in the past with 80xx and PIC parts. so nothing really new.

Thanks for working the numbers! Does Hitachi recommend other xtals, or is that the past for the older, slower uPs?

Alan KM6VV

_________________
Visit:
http://groups.yahoo.com/group/SherlineCNC/
http://tech.groups.yahoo.com/group/HexapodRobotIK/


Top
 Profile  
 
 Post subject: Re: ARC-32 SSC32 emulator code
PostPosted: Sun Aug 15, 2010 6:07 pm 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 7:00 pm
Posts: 1316
Location: Temecula, CA
We've always stuck with the max mhz a processor supports. To get all PC compatible baudrates on the Hitachi parts you have to use a 18.432000 mhx crystal on a 3687. On the 3694 it would have to be 14.745600 mhz. You take a big processing power hit on both processors, almost 8%. It didn't seem worth it.

This is because of the 32 divider Hitachi used on the H8 processors UARTS. Older PICmicros used a 4 divider IIRC. And the newest PICmicros have even higher ranges. You can hit almost any baudrate on a new PICmicro using any MHZ. I don't know about Atmel but since most Atmels run at the odd MHZ speeds I suspect they have a similar problem to the H8s.

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
 Post subject: Re: ARC-32 SSC32 emulator code
PostPosted: Mon Aug 16, 2010 8:42 pm 
Offline
Master

Joined: Tue Jun 22, 2010 9:15 pm
Posts: 228
Yes, I seem to remember the 18.432000 Mhz xtal for one processor or another. I'd be inclined to take the 8% hit, although it's a lot easier to get standard 20Mhz xtals!

Alan KM6VV

_________________
Visit:
http://groups.yahoo.com/group/SherlineCNC/
http://tech.groups.yahoo.com/group/HexapodRobotIK/


Top
 Profile  
 
 Post subject: Re: ARC-32 SSC32 emulator code
PostPosted: Tue Aug 17, 2010 5:09 pm 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 7:00 pm
Posts: 1316
Location: Temecula, CA
In todays world why would you want to take the hit. PCs are using USB to serial adapters which don't care what the oddball baud rate. The SSC emulator code for the ARC32 is so PCs can talk to it. It has an onboard USB to serial adapter and can run at 625kbps which is a site better than 115kbps. You can use it with a micro, though I'd think you'd be better off using the ARC32 as the micro instead of as a slave device in that case.

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
 Post subject: Re: ARC-32 SSC32 emulator code
PostPosted: Wed Aug 18, 2010 4:12 am 
Offline
Master

Joined: Tue Jun 22, 2010 9:15 pm
Posts: 228
That's true, there are higher baud rates available for a USB-serial cable. Just thinking out loud.

Alan KM6VV

_________________
Visit:
http://groups.yahoo.com/group/SherlineCNC/
http://tech.groups.yahoo.com/group/HexapodRobotIK/


Top
 Profile  
 
 Post subject: Re: ARC-32 SSC32 emulator code
PostPosted: Wed Aug 18, 2010 4:44 pm 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 7:00 pm
Posts: 1316
Location: Temecula, CA
Sure. On most microprocessors I expect the uarts can use some non-standard baudrates that the H8 support. In the cases where they don't 57600 is your best speed.

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
 Post subject: Re: ARC-32 SSC32 emulator code
PostPosted: Wed Aug 25, 2010 8:48 pm 
Offline
Master

Joined: Tue Jun 22, 2010 9:15 pm
Posts: 228
Took a laptop IBM on vacation with us, and the ARC-32.

Had older (installer says newer) AtomPro installed. Removed and installed latest 35 Studio. Installed the USB drivers.

Compiled and programmed the emulator code.

Set terminal baud rate to 38.4

Tries to sign on "Starting", but only partially gets the word out. Nothing past that, like a version number.

Stock "out of the box" ARC-32 on a 9v battery. Brought a pair of Futaba S3004 servos and a pair of Sharp GP2D12 IR rangers, (all disconnected) but that's about all. I probably should have brought a working BBII project w/ code to run on it, then tested the new Studio install.

Suggests a com problem, but thought I'd ask before looking further, what with all the new installs, and not my normal development machine.

Alan KM6VV

_________________
Visit:
http://groups.yahoo.com/group/SherlineCNC/
http://tech.groups.yahoo.com/group/HexapodRobotIK/


Top
 Profile  
 
 Post subject: Re: ARC-32 SSC32 emulator code
PostPosted: Thu Aug 26, 2010 4:58 pm 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 7:00 pm
Posts: 1316
Location: Temecula, CA
What is your powersupply? This same board worked on your main development computer? Also just to be safe don't let the installer uninstall the previous version. Go into add/remove programs and remove the previous version and then install the latest version. It sounds like you had 8.X installed previously?

So programming code to the ARC32 whent fine? Or is the "Starting" from code oyu had perviously loaded using your main computer?

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 37 posts ]  Go to page 1, 2, 3  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO