On 5/2/07, Crist=F3v=E3o Dalla Costa wrote: > Hello > > I'm encountering weird problems with a PIC18F4525. I'm working over a des= ign > I have working perfectly for over a year. The problem happens when I use = the > SPI module. > > The circuit uses 10 AD channels, PWM, capture, USART and now the SPI in > master mode . I did have a version that also used SPI without any problems > but that one used TMR2 for a 2 kHz clock. Now I'm using TMR2 for a 100 kHz > clock and so I'm driving SPI from clock/64. So here's the weird stuff that > happens when I enable SPI communication on the main loop: > > - I can't touch the CCP1 pin, RC2. If grounded or simply touched upon wit= h a > wire the processor will latch or reset. Configuring it as output doesn't > help. > - When communicating to the PC via USART the processor will reset or latch > in a minute or two. > - 20% of the times the processor is started from reset, it'll latch. > - the scope shows a 0,5 Vpp, 100 kHz square wave out of the CCP1 pin > regardless of being set as input or output. This mirrors the PWM pin next= to > it. > - disabling pwm makes everything stop working. > Have you made sure you have decoupling capacitors and a decent power supply for the PIC and the MAX232 and the other chips? That's often the problem I encounter when breadboarding circuits - not enough caps. -Scott -- = http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist