caramoan tour package

caramoan tour package

Author Topic: UART not working with XT PLL 8x using DSPIC30f4011  (Read 329 times)

Offline vaia-riseng

  • LR44 Battery
  • *
  • Posts: 6
  • Pogi/Ganda Points: 0
UART not working with XT PLL 8x using DSPIC30f4011
« on: December 07, 2011, 12:50:14 AM »
Hi! I am trying to work with dspic30f4011 UART capability. When the setting was in XT only, the UART was working. But when I edited it to XT with PLL 8x, no output came out from UART terminal.

Code: [Select]
void main() {
  TRISB = 0xFFFE;
  ADPCFG = 0xFFFF;

  UART1_Init_Advanced(9600,_UART_8BIT_NOPARITY,_UART_ONE_STOPBIT);
  UART1_Write_Text("Hello");
  Delay_ms(100);
}

My code is the one above. I have no idea what to change. I tried to change Baud rate from 9600 to 19200 but does not work. The settings are the following:

Primary Oscillator Mode: XT w/ PLL 8x
Oscillator Source: Primary Oscillator
Oscillator Frequency: 7.37MHz
 

Thank you in advance!

Philippine Electronics Forum

UART not working with XT PLL 8x using DSPIC30f4011
« on: December 07, 2011, 12:50:14 AM »

Offline RiDdLeR???

  • Hydroelectric
  • ***
  • Posts: 3033
  • Pogi/Ganda Points: 208
Re: UART not working with XT PLL 8x using DSPIC30f4011
« Reply #1 on: December 07, 2011, 07:49:05 AM »
If ever the oscillator frequency is wrong, you should still be able to get some sort of garbage output from the rs232 port.  Make sure that your program is running first.  Why not place a simple LED blinker code that flashes very 1 second.  If it flashes, then observe if it flashes approximately every one second  ... then at least you will know if you got the oscillator config right.

Philippine Electronics Forum

Re: UART not working with XT PLL 8x using DSPIC30f4011
« Reply #1 on: December 07, 2011, 07:49:05 AM »

Offline vaia-riseng

  • LR44 Battery
  • *
  • Posts: 6
  • Pogi/Ganda Points: 0
Re: UART not working with XT PLL 8x using DSPIC30f4011
« Reply #2 on: December 07, 2011, 12:35:08 PM »
Hi! Thank you for your reply. :) I managed to get garbage output from printing Hello in a while(1) loop. So my problem is that my oscillator frequency is wrong?

Philippine Electronics Forum

Re: UART not working with XT PLL 8x using DSPIC30f4011
« Reply #2 on: December 07, 2011, 12:35:08 PM »

Offline insomartin

  • Technical People
  • Nuclear Reactor
  • *****
  • Posts: 4838
  • Pogi/Ganda Points: 321
  • Gender: Male
  • Nalulunod lang...
Re: UART not working with XT PLL 8x using DSPIC30f4011
« Reply #3 on: December 07, 2011, 01:03:07 PM »
pa post nang buong Code mo. specially sa code mo in kung asaan yung clock speed sa code mo.

#define MX_CLK_SPEED 20000000 //sample


Philippine Electronics Forum

Re: UART not working with XT PLL 8x using DSPIC30f4011
« Reply #3 on: December 07, 2011, 01:03:07 PM »

Offline Kaizer03

  • Nuclear Reactor
  • ****
  • Posts: 4849
  • Pogi/Ganda Points: 225
  • C#<-->Android<-->Java
    • PhilRobotics
Re: UART not working with XT PLL 8x using DSPIC30f4011
« Reply #4 on: December 07, 2011, 01:08:19 PM »
^

walang ganyan sa MPLAB =)



@TS,

if your Crystal is greater than 4MHz, you must select HS instead of XT =)
Lend a hand for those who are in need!=)

Stop Hijacking!=) More Technical Posts!=)
 ;)

Kaizer Killer EX Pre-Alpha

Philippine Electronics Forum

Re: UART not working with XT PLL 8x using DSPIC30f4011
« Reply #4 on: December 07, 2011, 01:08:19 PM »

Offline insomartin

  • Technical People
  • Nuclear Reactor
  • *****
  • Posts: 4838
  • Pogi/Ganda Points: 321
  • Gender: Male
  • Nalulunod lang...
Re: UART not working with XT PLL 8x using DSPIC30f4011
« Reply #5 on: December 07, 2011, 01:09:48 PM »
... Shhhhh!

Offline motion55

  • Technical People
  • Diesel Generator
  • *****
  • Posts: 1890
  • Pogi/Ganda Points: 245
  • Gender: Male
  • Been at this longer than you've been alive.
Re: UART not working with XT PLL 8x using DSPIC30f4011
« Reply #6 on: December 07, 2011, 02:05:37 PM »
Quote
if your Crystal is greater than 4MHz, you must select HS instead of XT =)

Here is from the dsPIC30F4011 datasheet.



//////////////////////////////////////////////////////////////////////////////////////////////////

@TS

Hindi ako familiar with your compiler. I think hindi C30 from Microchip. But if the clock is multiplied 8X by the PLL then the baud rate should also increase by 8X. That is, 9600 baud has become 76800baud. Unless I am missing something because you did not disclose the entire source code.

"Set your mind free!"

Offline Kaizer03

  • Nuclear Reactor
  • ****
  • Posts: 4849
  • Pogi/Ganda Points: 225
  • C#<-->Android<-->Java
    • PhilRobotics
Re: UART not working with XT PLL 8x using DSPIC30f4011
« Reply #7 on: December 07, 2011, 02:13:26 PM »
^

thanks for correcting... i should have download and check the datasheet first =)

ngayon ko lang din napansin na di pala C30 yung Compiler.. since may "Delay_ms" though im not sure, since di ako familiar with the builtin libraries ng C30 =)
Lend a hand for those who are in need!=)

Stop Hijacking!=) More Technical Posts!=)
 ;)

Kaizer Killer EX Pre-Alpha

Offline motion55

  • Technical People
  • Diesel Generator
  • *****
  • Posts: 1890
  • Pogi/Ganda Points: 245
  • Gender: Male
  • Been at this longer than you've been alive.
Re: UART not working with XT PLL 8x using DSPIC30f4011
« Reply #8 on: December 07, 2011, 02:57:37 PM »
Quote
Primary Oscillator Mode: XT w/ PLL 8x
Oscillator Source: Primary Oscillator
Oscillator Frequency: 7.37MHz

Teka nga. Diba 7.37Mhz ay ang typical frequency ng FRC (fast RC oscillator)?

Kung FRC gamit mo diba dapat FRC with 8X PLL ang katapat?
"Set your mind free!"

Offline vaia-riseng

  • LR44 Battery
  • *
  • Posts: 6
  • Pogi/Ganda Points: 0
Re: UART not working with XT PLL 8x using DSPIC30f4011
« Reply #9 on: December 11, 2011, 12:06:27 PM »
Thank you po sa mga replies! Yung external clock ko ay 7.37 Mhz so RC po yung ginagamit ko. Yung gamit ko po pala ay yung mikroC na program.

Offline motion55

  • Technical People
  • Diesel Generator
  • *****
  • Posts: 1890
  • Pogi/Ganda Points: 245
  • Gender: Male
  • Been at this longer than you've been alive.
Re: UART not working with XT PLL 8x using DSPIC30f4011
« Reply #10 on: December 11, 2011, 10:05:43 PM »
@vaia-riseng

Mukhang nag-canvas ka sa mga electronics forum.

http://www.electro-tech-online.com/microcontrollers/123605-uart-dspic30f4011-using-xt-pll-8x.html

Sagot ko above ay similar kay phalanx. He has the advantage of getting more info.
"Set your mind free!"

Philippine Electronics Forum

Re: UART not working with XT PLL 8x using DSPIC30f4011
« Reply #10 on: December 11, 2011, 10:05:43 PM »

 

Privacy Policy

Contact Us: elabph@yahoo.com