Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Pic32 Baud rate issue :(

Status
Not open for further replies.

Makaram

Member
Hey, really can't crack the baud rate on my pic32f564f128h.

I've been trying for hours and have had lots of success with 12f and 16f uart in the past.

Could some1 please check what my problem is?
Also could some1 please explain the rs232 support they claim? does this mean that only rs232 is being used here?
I'm reading the output via a ttl to usb converter which I have always used with my other pics and am getting output though its just jibberish. for example while sending 48 (ascii '0') I was receiving
'g'. :S

Any help would be most appreciated
 

Attachments

  • main.c
    279 bytes · Views: 110
  • main_header.h
    3.4 KB · Views: 140
so you made a progress, something gets through. the usual culprits are wrong port setting on the PC side (must match MCU port settings), mCU serial port not initialized properly (wrong or unstable clock, wrong pin assignment, software errors) or wrong circuit.

what calls init function?

where is your circuit?
 
I'm confused with your configuration.... You have the FRC option selected but you are also selecting HS as your POSC... If you are using the FRC you need to tune the OSC with the osctun reg

Also your PBDIV is 1:1.. Your sysclock and peripheral clocks are set to the same speed...
 
My configuration is almost certainly the problem. I want to run off the internal osc.
#pragma config FPBDIV = DIV_2 // Peripheral Clock Divisor (Pb_Clk is Sys_Clk/2) Does this not mean PBDIV is 1:2?
 
To use a stable baud I would recommend an external crystal.... I made a small touch controller with a pic12f675 with an RS232 connection.... I had to play with the osctune to get it working reliably...

I only mentioned the PBDIV as you had 80000000 sysclock with a 40000000 peripheral clock in your text.. I run off an external 8 meg crystal at work.. I'll send you my config words tomorrow..
 
Thank you. I am also slightly perplexed with this rs232 support they claim. What does that mean? all previous uart configs I have used are TTL, is that still the case?
 
ASCII '0' and 'g' are almost inverted copies of each other, I think you have the polarity of the USART set wrong (ie it is set to RS232 polarity and not standard TTL polarity).
 
I think I might be in love with you. This was the issue. Though Changing the Peripheral divider does not seem to affect baud at all? weird.

THANK YOU all
 
I know you got it sorted but here's my config... ( Using 8meg external crystal)

Code:
#pragma config FPLLMUL = MUL_20, FPLLIDIV = DIV_2, FPLLODIV = DIV_1, FWDTEN = OFF
#pragma config POSCMOD = HS, FNOSC = PRIPLL, FPBDIV = DIV_8
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top