View previous topic :: View next topic |
Author |
Message |
vminin Guest
|
soft rs232 doesn't work at 115200 as hard works |
Posted: Fri Oct 05, 2007 1:40 pm |
|
|
I wanted to connect Bluetooth module to my 18f252 using b4-b5 via 115200 br rs232 but couldn't do that. I got some garbage on my Hyper Terminal. When I switched to the c6-c7 I got right output on the screen.
Any ideas?
P.S. at 57600 everything was correct in both scenarios |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Oct 05, 2007 1:45 pm |
|
|
1. What is the PIC's oscillator frequency ?
2. What is your compiler version ? |
|
|
vminin Guest
|
|
Posted: Fri Oct 05, 2007 2:16 pm |
|
|
30000000
4.057 |
|
|
vminin Guest
|
|
Posted: Fri Oct 05, 2007 2:20 pm |
|
|
more input:) I have no flow control in both cases. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Oct 05, 2007 2:29 pm |
|
|
What happens if you don't use the Bluetooth module ? Just connect
the PIC to your PC, and type text in a terminal window. Does it work
at 115200 baud with a software UART ? |
|
|
vminin Guest
|
|
Posted: Fri Oct 05, 2007 2:53 pm |
|
|
good point!
Yes, it works . And BTM works as well with HT at 115200 |
|
|
Ttelmah Guest
|
|
Posted: Fri Oct 05, 2007 2:58 pm |
|
|
If I remember, we did some 'loop counting' a while ago, in another thread, and worked out how many instruction cycles were needed for soft RS232. The figure was somewhere round 45 instructions 'worst case' in the bit loop. At 30Mhz, you shold be able to handle this (65 instruction times available). It may be that the newer compiler is actually 'worse' at handling this than the older versions....
The only way to really find out if you are running out of loop time, would be to compile some test code, with higher and higher baud rtes, and look at the listing, to find the point where the shortest delay reaches zero.
Best Wishes |
|
|
vminin Guest
|
|
Posted: Fri Oct 05, 2007 3:04 pm |
|
|
to Ttelmah: If it couldn't handle cycles, would it work with the Hyper Terminal? |
|
|
vminin Guest
|
|
Posted: Fri Oct 05, 2007 3:43 pm |
|
|
to Tlelmah - it looks like you are right. If I add couple instruction in the loop it stops working. I will replace clock with 40Mhz and try v.3.xx compiler.
Any way, thanks guys for your help, I'll post result if any |
|
|
|