Em 22/3/2012 20:44, IVP escreveu: >> I have been shooting for 115200 with out any luck > Hi Bill, > > Section 20.1 of DS39623B outlines how to select a baud rate > > (it's been a little while since I did this, apologies for any errors) > > BRGH =3D 0 > > ((Fosc/baud rate)/64)-1 > > ((20000000/9600)/64)-1 > > BRG =3D 31.55 > > ((20000000/115200)/64)-1 > > BRG =3D 1.71 > > With BRGH =3D 1 > > ((20000000/115200)/16)-1 > > BRG =3D 9.85 (call it 10) > > The actual baud rate is > > 20000000/(16(10+1)) > > =3D 113636 > > with an error of (113636 -115200)/115200 =3D 1.36% slow. This would > probably not be a problem if each frame is synched. For long streams > with no reference the receiver will drift away from the incoming data > > A 'hexadecimal' crystal is more suitable for common baud rates, but > whether you can or do use one depends on the functional priorities. For > example if a microsecond timer is more important than comms, then a > 20MHz would be preferable (for the 200ns cycles). You might have to > compromise somewhere > > An 18.432MHz crystal in the calculations > > ((18432000/115200)/16)-1 > > =3D 9.000000, no error > > Joe The problem is that the USB peripheral needs a 48MHz clock to operate. The main clock is constrained to values that after being multiplied by the PLL and divided by the pre/postscalers can result in an USB clock of 48MHz. Isaac --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .