PDA

View Full Version : One-Wire Timing Using PLL



CocaColaKid
- 12th September 2005, 21:10
I have a circuit that is reading 5 DS18B20 temp sensors at 16MHz (4 MHz x 4 PLL). The circuit works fine until I pop in a 10 MHz crystal then I lose the sensor that is running on parasite power. Is there some timing that needs to be modified in the owin and owout commands? I tried a totally different circuit and it works fine so I know the configuration setup is alright.

mister_e
- 12th September 2005, 21:23
what about your Config Fuses? Did you redefine the osc => DEFINE OSC 40?

There's no special timing balahblah for the OWIN/OWOUT

CocaColaKid
- 12th September 2005, 21:26
Yep, did that. Here's the top of the code.



DEFINE LOADER_USED 1 ' Bootloader is being used
DEFINE OSC 40 ' Set oscillator frequency, 4MHz (HS_PLL x4)
DEFINE HSER_BAUD 9600 ' Baud rate for serial output
DEFINE HSER_CLROERR 1 ' Automatically clear over-run errors
DEFINE HSER_RCSTA 90h ' Enable USART receive
DEFINE HSER_TXSTA 24h ' TXSTA=%00100100. TX enable, BRGH=1 for high-speed

DEFINE LCD_DREG PORTD
DEFINE LCD_DBIT 4
DEFINE LCD_RSREG PORTC
DEFINE LCD_RSBIT 0
DEFINE LCD_EREG PORTC
DEFINE LCD_EBIT 1
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2

@ __CONFIG _CONFIG1H, _OSCS_OFF_1H & _HSPLL_OSC_1H
' Oscillator Switch Disable
' Oscillator Type HS PLL

@ __CONFIG _CONFIG2L, _BOR_ON_2L & _PWRT_ON_2L & _BORV_45_2L
' Brown-Out Reset Enabled
' Power-Up Timer Enable
' Brown-Out Reset Voltage 4.5V

@ __CONFIG _CONFIG2H, _WDT_ON_2H
' Watch Dog Timer Enable

@ __CONFIG _CONFIG4L, _STVR_ON_4L & _LVP_OFF_4L & _DEBUG_OFF_4L
' Stack Over/Underflow Reset Enable
' Low Voltage ICSP Programming Disabled
' Background Debugger Disabled

mister_e
- 12th September 2005, 21:34
Config fuse will never be programmed with the BOOTLOADER so remove them.

Be sure you used the PLL version of the BOOTLOADER and you set the config fuse at programming time before loading the Booloader firmware and it's suppose to work As IS.

CocaColaKid
- 12th September 2005, 22:11
The config fuses are there so I don't forget to add them in when I program them using the ME Labs serial programmer. I used the PLL David Barker sent me and it works fine on other programs but this one is giving me grief for some reason. It only seems to effect the parasite powered sensor though. If I run a three wire connection it works fine.

mister_e
- 12th September 2005, 22:28
mmm, as it worked with a 4MHZ, i'll bet on a hardware problem now. something like a lack of supply filtering. Placing 0.1uF capacitor close to each sensor and close to each IC + couple of 10uF tantalum could fix it.

Did you monitor the supply line???


No problem with the LCD???

But i've never tested OWIN/OUT @40MHZ so... i can just bet on few things.

CocaColaKid
- 13th September 2005, 13:12
Well I tried the caps thing and the same result. I then again tried the parasite power right on the board and it worked fine so that got me thinking about the 4.7k pull-up on the data line. I thought that maybe the resistance was a little too high so I tried a 2.2k and low and behold, it can to life. What I don't really understand though is why the difference when I switched between the 4 and 10 MHz crystals.

mister_e
- 13th September 2005, 14:15
Well all i can say, using the PLL the difference is 24MHZ. The problem would be the same with some I2C device at high SCL frequency. Some datasheet will suggest 1.8K for high frequency and 4.7K for lower frequency.