CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

is it possible to communicate at 1Mbps

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Ringo42



Joined: 07 May 2004
Posts: 263

View user's profile Send private message

is it possible to communicate at 1Mbps
PostPosted: Wed Sep 12, 2007 12:36 pm     Reply with quote

I would like to control some dynamixel servos, but they talk at 1000000 bits per second asynchronous serial. I'm using an 18f452 with a 10Mhz xtal and a pll setting of X4.
Looking at tthe data sheet on 170 is shows that to calculate the error for a specific baud rate you use
Desired Baud Rate = FOSC / (64 (X + 1))
Solving for X:
X = ( (FOSC / Desired Baud Rate) / 64 ) – 1
X = ((40,000,000 / 1,000,000) / 64) – 1
X = -.375 (negative number)

from this I would assume it is impossible to do.

Does anyone know of a pic in the 16 or 18F family that can do 1Mbps?
_________________
Ringo Davis
libor



Joined: 14 Dec 2004
Posts: 288
Location: Hungary

View user's profile Send private message

PostPosted: Wed Sep 12, 2007 12:51 pm     Reply with quote

Counting with e.g. 8 bytes / packet 1Mbps would mean 80us for transmitting the packet. What do you plan your decision algorythm would be that does not need some magnitudes more time running in a PIC to thoughtfully compose these packets instructing your servos doing meaningful things ?

BTW the theoretical max. baud rate is Fosc / 64 = 625kpbs at 40 Mhz. Though you'll have to find a quartz / divider value that matches a standard baudrate.


Last edited by libor on Wed Sep 12, 2007 1:09 pm; edited 2 times in total
Ringo42



Joined: 07 May 2004
Posts: 263

View user's profile Send private message

PostPosted: Wed Sep 12, 2007 12:59 pm     Reply with quote

If I understand your question correctly, the pic will not be sending packets 100% of the time, then there would be no time for make decisions on what to send. It might only send a packet every 20 mS. I don't know yet, I'm still trying to figure out if it can work with a pic.
Ringo
_________________
Ringo Davis
libor



Joined: 14 Dec 2004
Posts: 288
Location: Hungary

View user's profile Send private message

PostPosted: Wed Sep 12, 2007 1:07 pm     Reply with quote

I suppose these servos can communicate at a lower bps rate also, the 1Mbs is the maximum.
If you plan to send them instructions with a 20 ms interval as the fastest, then what is the reason you insist on sending the packet in 0.08 ms ?
It is like you were talking to your friend once a day only, and you were thinking of how to shorten your sentences into 1 sec instead of 10 secs. I don't see the point.
Ringo42



Joined: 07 May 2004
Posts: 263

View user's profile Send private message

PostPosted: Wed Sep 12, 2007 1:09 pm     Reply with quote

Because 1Mbs is the default speed. If you can't talk to the servo, you can't lower the speed.
_________________
Ringo Davis
libor



Joined: 14 Dec 2004
Posts: 288
Location: Hungary

View user's profile Send private message

PostPosted: Wed Sep 12, 2007 1:23 pm     Reply with quote

With a software (bit banging) solution you easily make a 1 Mbps rate. (you will have exactly 10 instructions of time for each bit at 40 Mhz) You can make longer breaks between the bytes holding the line in stop (high) state.

Thpough I would suggest to use a bit-banged packet to tell the servo to switch to a lower speed always after power on and go on with the hardware USART with 115200 bps or so.
Ringo42



Joined: 07 May 2004
Posts: 263

View user's profile Send private message

PostPosted: Wed Sep 12, 2007 1:28 pm     Reply with quote

It looks like the 18F4550 may work if I use a 48Mhz xtal. At least the code compiles :-)
_________________
Ringo Davis
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Wed Sep 12, 2007 2:19 pm     Reply with quote

The newer PIC processors with Enhanced UART do have baudrate generators with division factors of 64, 16 and 4. At 40MHz and a division by 4 you could achieve a maximum bitrate of 10Mbit.
Ringo42



Joined: 07 May 2004
Posts: 263

View user's profile Send private message

PostPosted: Wed Sep 12, 2007 2:22 pm     Reply with quote

Cool, looks like the 18F4550 it is then
_________________
Ringo Davis
Ringo42



Joined: 07 May 2004
Posts: 263

View user's profile Send private message

PostPosted: Wed Sep 12, 2007 3:32 pm     Reply with quote

Can someone that is familiar with the 18f4550 please explain the Clock system to me. Reading the Data sheet is confusing. I'm looking at some source code that came with ta demo board. The source has
#fuses HSPLL,NOWDT,NOPROTECT,NOLVP,NODEBUG,USBDIV,PLL5,CPUDIV1,VREGEN
#use delay(clock=48000000)

But the board has a 20mhz xtal on it. I'm assuming that means the USB section runs at 48mhz, but the rest of the chip runs at 20mhz, is this correct? If so is there a way to get the rest of the chip to run at 40mhz? is there a crystal and Fuse configuration that would work for this?

Thanks
Ringo
_________________
Ringo Davis
libor



Joined: 14 Dec 2004
Posts: 288
Location: Hungary

View user's profile Send private message

PostPosted: Wed Sep 12, 2007 4:03 pm     Reply with quote

Look at this thread: PIC18F2550 & PIC18F2550 crystal settings

In the 2nd post Ttelmah explains it clearly, look also at the last post, there's a link to a graphic explanation.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group