Today 00:53
Forum: Proton Plus Compiler v3
Starter: Dave-S
Views: 0
Replies: 4
Yesterday 18:24
Forum: The Lounge
Starter: Tim
Views: 0
Replies: 13
Yesterday 13:10
Forum: Test Postings
Starter: IstvanK
Views: 0
Replies: 0
+ Reply to Thread
Results 1 to 10 of 10

Thread: 18F86J55 Oscillator configurations34 days old

  1. #1
    Member Dave-S's Avatar
    Join Date
    Sep 2004
    Posts
    256
    Thumbs Up
    Received: 5
    Given: 0
    Total Downloaded
    268.81 MB

    0 Not allowed!

    Default 18F86J55 Oscillator configurations

    Hi,

    I need some help and advice how to setup the 18F86J55 Oscillator configurations, It requires the USB and 18F86J55 core to both run at 48Mhz. I have it set as follows:-

    Device = 18F86J55

    Code:
    Config_Start
      WDTEN = Off	;WDT enabled
      PLLDIV = 5	;Divide by 5 (20 MHz oscillator input)
      STVREN = On	;Reset on stack overflow/underflow enabled
      XINST = OFF	;Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
      Debug = OFF	;Background debugger disabled; RB6 and RB7 configured as general purpose I/O pins
      CPUDIV = OSC1	;No CPU system clock divide
      Cp0 = OFF	;Program memory is not code-protected
      FOSC = HSPLL	;HS oscillator, PLL enabled, HSPLL used by USB
      FCMEN = On	;Fail-Safe Clock Monitor enabled
      IESO = On	;Two-Speed Start-up enabled
      WDTPS = 32768	;1:32768
      EASHFT = On	;Address shifting enabled, address on external bus is offset to start at 000000h
      MODE = MM	;Microcontroller mode - External bus disabled
      BW = 16	;16-bit external bus mode
      Wait = OFF	;Wait states on the external bus are disabled
      CCP2MX = DEFAULT	;ECCP2/P2A is multiplexed with RC1
      ECCPMX = DEFAULT	;ECCP1 outputs (P1B/P1C) are multiplexed with RE6 and RE5; ECCP3 outputs P3B/P3C) are multiplexed with RE4 and RE3
      PMPMX = DEFAULT	;PMP pins placed on EMB
      MSSPMSK = MSK7	;7-Bit Address Masking mode enable
    Config_End
    
         
        Declare Xtal = 48
        
        Declare Optimiser_Level = 3             ' Maximum optimisation
        Declare Dead_Code_Remove = On           ' Squeeze the code further
        Declare Warnings = Off
        Declare All_Digital = True
     
        OSCTUNE.6 = 1
        DelayMS 350
    I have a external Oscillator 20Mhz and have the PLL division set to divide by 5 and CPUDIV1/0 (OSC1) set as divide by 1.
    With the .bas and no include files it works ok and the 18F86J55 runs at 48Mhz as it should, as shown in the data sheet Table 2.5. But as soon as I add the include files it only runs at 40Mhz which I cannot understand because there is nothing in the include files that would change it. The include files are the Proton_USB_HID_Stack, I have removed (when the problem first occurred) the Configs from the USB_Defs.inc and the only configuration is the one shown above and is at the top of the .bas file.

    Any Ideas how to solve this.

    Thanks David

  2. #2
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    1,327
    Thumbs Up
    Received: 49
    Given: 123
    Total Downloaded
    2.37 GB

    0 Not allowed!

    Default Re: 18F86J55 Oscillator configurations

    Perhaps some configs being erroneously read from USB_Defs.inc, try removing all the configs from it.

    Also, could the default configs in the PPI file being "getting in the way"?
    Last edited by towlerg; 17th October 2017 at 00:44.
    George

  3. #3
    Member Dave-S's Avatar
    Join Date
    Sep 2004
    Posts
    256
    Thumbs Up
    Received: 5
    Given: 0
    Total Downloaded
    268.81 MB

    0 Not allowed!

    Default Re: 18F86J55 Oscillator configurations

    Quote Originally Posted by towlerg View Post
    Perhaps some configs being erroneously read from USB_Defs.inc, try removing all the configs from it.

    Also, could the default configs in the PPI file being "getting in the way"?
    As stated in above I have removed all configs from USB_Defs.inc file, will try to remove default from PPI file.

    Thanks David.

  4. #4
    Member Dave-S's Avatar
    Join Date
    Sep 2004
    Posts
    256
    Thumbs Up
    Received: 5
    Given: 0
    Total Downloaded
    268.81 MB

    0 Not allowed!

    Default Re: 18F86J55 Oscillator configurations

    Have removed Default configs from PPI file, still the same only runs at 40Mhz and does not connect to USB.
    Tried setting default configs in PPI to correct settings and still the same problem.
    Cannot understand where it is getting the 40Mhz from, as there is not a setting in the data sheet for that.

    David

  5. #5
    Member Stephen Moss's Avatar
    Join Date
    Jan 2006
    Posts
    382
    Thumbs Up
    Received: 20
    Given: 2
    Total Downloaded
    1.32 GB

    0 Not allowed!

    Default Re: 18F86J55 Oscillator configurations

    The clue is in it working correctly with the removal if the include files, either the include files contain a different configuration or themselves have an include file which contains a configuration and coming later in the program listing those configurations are overriding your configuration - the joys of using someone else's files without actually looking at them to see what they do.

    A quick look at the USB_Defs.inc files shows several configurations at the end, although your specific device is not mentioned the 18F86J50 is. I don't know how the complier works but it is logical to conclude that is uses that single config reference for all 18F86J5x devices as I presume that are all essentially the same bar pin count and memory size.
    Try copying the contents of the USB_Defs.inc to a new .inc file and either rem out that configuration so that you configuration is used or change it to match your configuration and see if you get the frequency you expect then.

  6. #6
    Prolific Poster joesaliba's Avatar
    Join Date
    Sep 2004
    Posts
    2,620
    Thumbs Up
    Received: 59
    Given: 18
    Total Downloaded
    2.27 GB

    0 Not allowed!

    Default Re: 18F86J55 Oscillator configurations

    In the USB_Defa.inc include add your own fuses if the PIC you are using is not there.
    Regards

    Joseph

  7. #7
    Prolific Poster hadv215's Avatar
    Join Date
    Sep 2009
    Posts
    1,035
    Thumbs Up
    Received: 85
    Given: 19
    Total Downloaded
    927.31 MB

    0 Not allowed!

    Default Re: 18F86J55 Oscillator configurations

    Are you sure it is running at 40 MHz? How did you determine this?

    Not connecting can also be caused by problems in the device configuration file, the PC will show an error if you insert your device.

    BTW you configs look OK

  8. #8
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    1,327
    Thumbs Up
    Received: 49
    Given: 123
    Total Downloaded
    2.37 GB

    0 Not allowed!

    Default Re: 18F86J55 Oscillator configurations

    Do you get the same problem if you use the internal USB commands?
    George

  9. #9
    Member Dave-S's Avatar
    Join Date
    Sep 2004
    Posts
    256
    Thumbs Up
    Received: 5
    Given: 0
    Total Downloaded
    268.81 MB

    1 Not allowed!

    Default Re: 18F86J55 Oscillator configurations

    OK have solved it, it was the connection to the Vusb pin which has to have a 3.3 volts connected to it. I had all this working OK on a 18F4550 and connected as shown in Proton manual with only a capacitor from Vusb to Vss, and then connected up the 18F86J55 the same. Having read the data sheet I find it has to have a 3.3 volt connected to the Vusb pin.

    Thanks for all your help.
    David

  10. #10
    Member Dave-S's Avatar
    Join Date
    Sep 2004
    Posts
    256
    Thumbs Up
    Received: 5
    Given: 0
    Total Downloaded
    268.81 MB

    0 Not allowed!

    Default Re: 18F86J55 Oscillator configurations

    Hi,
    Still having problems transferring the Keyboard code from a 18F4550 (where it worked ok) to a 18F86J55.

    I thought I had this now working ok but it is not. Having removed some of the Keyboard code when it would not connect to the USB, now reinserting and adding more code have further problems.
    Have Columns and Rows Matrix and when doing a Key scan and setting column (TRISx = 0) to output and then setting PORTx = 0 it somehow resets the USB, it changes from Keyboard to a USB input device with a yellow triangle and constantly switches back and forth. When showing as a USB Input device it is running at 40Mhz when a Keyboard it is running at 48Mhz, my serial output shows gibberish when running at 40Mhz. Have tried using variables/symbols in place of TRIS/PORT tried using LATx.

    serial output:-----

    Clear HID_Report_In
    Clear HID_Report_In
    @ƒ@‘Œ‘@@ƒ@™Œ‘@@ƒ @™Œ‘@
    @ƒ@˜‘Œ‘@@ƒ@‘Œ‘@@ƒ @‘Œ‘@

    The "Clear HID_Report_In" is when it is running at 48Mhz, the rest is the same but because the speed is wrong, if I change the Xtal to 40 in the code the above reverses. It appears to go through the USB code twice and through the USB input device code six times.

    Also when showing as a USB Input device it only flashes the LED at the start of the Program and not the LED further down in the code but it is going all through the code otherwise it could not output the "Clear HID_Report_In".

    Cannot understand how this can effect the USB connection.

    If I comment out the PORTx = 0 instructions for all the columns it stays connected ok as a Keyboard.

    A couple of other problems which I can work around, originally I had the serial output connected to PORTG.1 but when I set the ports PORTG.0/PORTG.3/PORTG.4 to inputs the serial stopped outputting, I have connected to the PORTJ.5.

    The PORTC.3 shows 3.3 volts all the time even when I set it LOW.

    Has anyone used a 18F86J55 ? Any ideas?

    Thanks David

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. USB Dual Ram Memory error 18F86J55
    By Dave-S in forum USB Module
    Replies: 0
    Last Post: 14th October 2017, 16:37
  2. [SOLVED !] 18F25K22 analog PINs configurations
    By BariRaul in forum Proton Plus Compiler v3
    Replies: 2
    Last Post: 20th January 2016, 13:00
  3. HSerout2 - Configurations
    By fgcity in forum Proton Plus Compiler v3
    Replies: 17
    Last Post: 18th January 2012, 11:27
  4. Configurations on the Fly
    By naseerak in forum Proton Plus Compiler v3
    Replies: 2
    Last Post: 27th October 2010, 11:49
  5. Setting Configurations bits 16F628
    By J J Larsen in forum Proton Plus Compiler v3
    Replies: 10
    Last Post: 25th May 2010, 08:54

Members who have read this thread since 7th November 2017, 22:28 : 0

Actions :  (Set Date)  (Clear Date)

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts