Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] correct fuse settings for 18F4550 as an USB device

Status
Not open for further replies.
yes , i got the datasheet and know the config bits ,
but the real problem is with the burner software , it uses non standard or atleast non identifiable fuses , means it says
Div/2 wPLL No div , from datasheet for 20MHz crystal , its not there

available options for
CPUDIV are ,
Div/6 wPLL Div/4
Div/4 wPLL Div/3
Div/3 wPLL Div/2
Div/2 wPLL No div
 
Last edited:

can anyone help me in selecting CPUDIV value from
CPUDIV are ,
Div/6 wPLL Div/4
Div/4 wPLL Div/3
Div/3 wPLL Div/2
Div/2 wPLL No div ? for 20MHZ crystal
 

can anyone help me in selecting CPUDIV value from
CPUDIV are ,
Div/6 wPLL Div/4
Div/4 wPLL Div/3
Div/3 wPLL Div/2
Div/2 wPLL No div ? for 20MHZ crystal


Since thats only option you have, use 16MHz crystal instead and use Div/6 wPLL Div/4. You will have 16MHz PIC oscillation
 

is there any other option for using 20MHz crystal ?
 

is there any other option for using 20MHz crystal ?

After the 20MHz, you need to get 4MHz. Thus, requiring you to do a PLL/5. But, you dont have that. Please look t the datasheet on the oscillator diagram
 
  • Like
Reactions: varunme

    varunme

    Points: 2
    Helpful Answer Positive Rating
After the 20MHz, you need to get 4MHz. Thus, requiring you to do a PLL/5. But, you dont have that. Please look t the datasheet on the oscillator diagram
is it a problem of burner ?
 

ok , so i have to limit with 16Mhz isnt it ?
 

but i have to use the 20Mhz crystal firmware from microchip , can i change it to 16Mhz by changing the value in burner software ?
 

No!

Set the fuses in the original program. If your version of Microburn doesn't show a particular setting inthe window it doesn't mean it won't use it. The fuse information is normally embedded in the HEX file and will be used 'as is' by Microburn. Normally, you don't have to change the settings in the microburn window at all, the option to change them is there only for rare cases when an old assembler doesn't embed the data in the hex file and it has to be set manually. This will only apply to a very few older assemblers, anythng that can handle an IC as recent as the 18F series should be able to embed the data itself.

Please bear in mind that your microburn program is probably 6 years or more old by now and was produced when PICs with USB were still quite rare.

Brian.
 
  • Like
Reactions: varunme

    varunme

    Points: 2
    Helpful Answer Positive Rating
so the steps for me are

1. Change the crystal to 16Mhz.
2. Recompile a firmware to support that 16Mhz.
3. Change the settings in microburn to match 16Mhz.

isnt it ?
 

Please read carefully ........ why do you want to change the settings in microburn?

The compiler should set the fuses and save their settings in the HEX file. All microburn does is copy the data from the hex file to the PIC, including the fuse settings. Normally you never have to even look at the fuses configuration page.

If you use a 20MHz crystal, that is absolutely OK, just make sure the fuses are set accordingly *IN YOUR PROGRAM* before recompiling the HEX file.

Brian.
 

hi betwixt , please read what John blue has said


After the 20MHz, you need to get 4MHz. Thus, requiring you to do a PLL/5. But, you dont have that. Please look t the datasheet on the oscillator diagram

my burner has a limitation of 16Mhz

please comment on this with your opinion

My problem is the interfacing of 18F4550 doesnt detect the pic , it says device not recognized , may be due to oscillator setting , i am using the firmware from microchip and many others i have tried , for all firmwares the /by5 option is not visible.
 
Last edited:

The point I'm making is from step 3. of a few messages back. The fuse information is set in the source code and is embedded in the HEX file when you compile. Step 3 is not necessary, let microburn use the settings in the HEX file, do not change them in microburn's fuse configuration screen.

To run USB you need to be able to create a 96MHz inside the PIC so it is necessary to use a crystal which can generate that frequency by using the internal dividers and PLL. 20MHz would not generate a valid USB stream I agree.

Why do you say "my burner has a limitation of 16MHz" ? The PIC oscillator isn't even running when you program it, the rate is set by the programmer (148, PicKit etc.) toggling the PGC and PGD pins so there is no restriction on the final operating speed.

Brian.
 
  • Like
Reactions: varunme

    varunme

    Points: 2
    Helpful Answer Positive Rating
so , i have to use a 16Mhz crystal or any other valid frequency for usb isnt it ?

or any other option for me ?
microchip is providing firmware for 20Mhz isn't it ? , so how can i solve this ?
please help

one code example for 20Mhz

Code:
// Shane Tolmie of www.microchipC.com.
#include <pic18.h>

#if !defined(HI_TECH_C) 
  #error Incorrect compiler. PICC18 v8.35PL2 from www.htsoft.com required.
#endif
#if defined (_18F2550) || defined (_18F4550)
  #define PIC_CLK 20000000 // MUST ATTACH an external 20Mhz crystal to PICC18F4550
  #if PIC_CLK==20000000
		// copied from 20Mhz settings on CDC sample project on www.microchip.com
		// 20Mhz crystal
		// CPU core runs at 48Mhz (with PLL), generating 12MIPS (million instructions/second)
		__CONFIG(1,HSPLL & USBPLL	& PLLDIV5 & CPUDIV1 & FCMDIS & IESODIS);
		__CONFIG(2,VREGEN & PWRTDIS & BOREN & BORV20 & WDTDIS & WDTPS32K);
		__CONFIG(3,CCP2RC1 & PBADDIS & LPT1DIS & MCLREN);
		__CONFIG(4,STVREN & LVPDIS & ICPORT & XINSTDIS & DEBUGDIS);
		__CONFIG(5,UNPROTECT);
		__CONFIG(6,UNPROTECT);
		__CONFIG(7,UNPROTECT);
	#else
		#error Incorrect crystal speed.
	#endif
#else
  #error Unknown microcontroller
#endif
 

The example is correct for a 20MHz crystal. The PLLDIV5 number is how many times it has to be divided to give 4MHz so (20/5) gives 4MHz, for a 16MHz crystal use PLLDIV4 (16/4) instead.

The important lines for 20MHz is:
"#define PIC_CLK 20000000" and "__CONFIG(1,HSPLL & USBPLL & PLLDIV5 & CPUDIV1 & FCMDIS & IESODIS);"

if you want to use a 16MHz crystal use this instead:
"#define PIC_CLK 16000000" and "__CONFIG(1,HSPLL & USBPLL & PLLDIV4 & CPUDIV1 & FCMDIS & IESODIS);"

If you look in the data sheet at the oscillator diagram (Fig 2-1) you will see that your crystal sits across the OSC1 and OSC2 pins. The frequency leaving the prescaler and MUX must be 4MHz, if it is anything else the USB clock will be wrong and it will not be compatible with other USB connections. You adjust the PLLDIV setting to cater for different crystal frequencies to get 4MHz out.

Brian.
 
  • Like
Reactions: varunme

    varunme

    Points: 2
    Helpful Answer Positive Rating
One more doubt , if it iritates you , please forgive me ,
why cant I use a 20Mhz crystal , my board is also having a 20Mhz crystal and firmware I am using is for 20Mhz ,
thank you
varun
 

You CAN use 20MHz. Sorry If I misled you earlier.

USB can in theory work at any speed but the device and host must run at the same speed as each other or they will not connect. There are standards to ensure all devices are compatible and the standard you are trying to use works with a 12Mb/s transfer rate (Full speed USB). To work at that speed the internal USB interface needs a clock at 96MHz and it derives the frequency by dividing the crystal frequency using PLLDIV then multiplying the result by 24 in the PLL. To get 96MHz out of the PLL you must feed 4MHz in to it, no other frequency will comply with standards.

The 4 MHz can be derived several ways:

Crystal is 4MHz and PLLDIV 2:0 is 000
Crystal is 8MHz and PLLDIV 2:0 is 001
Crystal is 12MHz and PLLDIV 2:0 is 010
Crystal is 16MHZ and PLLDIV 2:0 is 011
Crystal is 20MHz and PLLDIV 2:0 is 100
Crystal is 24MHz and PLLDIV 2:0 is 101
Crystal is 40MHz and PLLDIV 2:0 is 110
Crystal is 48MHz and PLLDIV 2:0 is 111

In addition, if 48MHz is used, the PLLDIV and PLL can be bypassed completely but this isn't what you should do in your project.
So you can use any of those crystal frequencies as long as PLLDIV is set so it divides to produce 4MHz out.

Brian.
 
  • Like
Reactions: varunme

    varunme

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top