24FC64 EEPROM Running at 1Mhz ?


+ Reply to Thread
Results 1 to 11 of 11
  1. #1
    Join Date
    Jan 2022
    Posts
    42

    Default 24FC64 EEPROM Running at 1Mhz ?

    Hello,

    My Project : PIC18F25K22 and 24FC64 1Mhz SCL EEPROM

    I'm able to run code for eeprom at 400Khz SCL , 24LC16B , LC64 , LC256 , LC512 with the MSSPx pin SCL2:PORTB.1, SDA2:PORTB.2

    or any other I/O Port since the I2Cwrite,read are software base as my understanding so far except MSSPx on the SCL1,SCL1 does not run.

    I having a hard time to figure the register for the MSSP: SSP1STAT, SSP1ADD, SSP1CON1

    does a 24FC64 at 5Vcc (at 1 Mhz SCL) should be running twice as fast than a 24LC64 at 400kHZ.

    from the Microchips AN989 it's seem's to be easy to make it work , but after couples a days on it I decided to look for answer.

    my question is does anybody has any experience running the FC eeprom series at 1 Mhz clock on the MSSP port with PBP3 Pro

    or PBP3 Pro compiler does not control the MSSP directly.


    I'll appreciate any feedback.

    Thanks to everyone.

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,631


    Did you find this post helpful? Yes | No

    Default Re: 24FC64 EEPROM Running at 1Mhz ?

    i2c via the mssp module works very well at whatever clock speed you set it to, done properly.
    what have you tried ?
    post the code for your best attempt
    Warning I'm not a teacher

  3. #3
    Join Date
    Jan 2022
    Posts
    42


    Did you find this post helpful? Yes | No

    Default Re: 24FC64 EEPROM Running at 1Mhz ?

    Hello Richard,

    this is the code for all the eeprom I tested.

    For the 24FC64
    The best I've got it working it's at 400Khz on MSSP2 Port's
    the MSSP1 does not work at all with the config I tried

    'SSP1STAT = $40 'p:252
    'SSP1ADD = $f 'p:258
    'SSP1CON1 = $8 'p:254

    I'm not well experienced but I'm trying and learning.
    does the this PIC can work with an 24FC64 AT 1Mhz?

    thanks for your help.



    Code:
    '-------------------------------------------------------------------------
    ' Name    : 18F25K22  EEPROM 1Mhz Test BK.pbp                                      
    ' only for 400Khz
    ' Date    : Jan 11 2025                                                
    '
    ' not working PORTC.4, PORTC.3
    ' SDA / SCL  4K7 Resistor
    '
    '-------------------------------------------------------------------------
     Include "modedefs.bas" ' Include serial modes
    ;----[18F25K22 Hardware Configuration]------------------------------------------
    #CONFIG
      CONFIG  FOSC = INTIO67     ; Internal oscillator block
      CONFIG  PLLCFG = On        ; Oscillator multiplied by 4
      CONFIG  PRICLKEN = ON      ; Primary clock enabled
      CONFIG  FCMEN = OFF        ; Fail-Safe Clock Monitor disabled
      CONFIG  BOREN = SBORDIS    ; Brown-out Reset enabled in hardware only (SBOREN is disabled)
      CONFIG  WDTEN = Off        ; WDT is always enabled. SWDTEN bit has no effect
      CONFIG  MCLRE = INTMCLR    ; RE3 input pin enabled; MCLR disabled
      CONFIG  LVP = Off          ; Single-Supply ICSP disabled
    #ENDCONFIG
    
    
    'SSP1STAT = $40     'p:252
    'SSP1ADD = $f       'p:258
    'SSP1CON1 = $8      'p:254
    
    
        ANSELA = 0      'All Digital
        ANSELB = 0
        ANSELC = 0
    
    
    DEFINE OSC 64          '4MHz ~ 64MHz
    TRISA = %00001000      ' 0:Out 1:In
    TRISB = %00000000
    TRISC = %00011000  
    OSCCON = $70
    OSCTUNE = $5F            
    
    
    ' EEPROM Setup -----------------------
    'I VAR byte 'byte FOR 24LC16B
    I VAR WORD 'Word FOR 24LC64 / 24LC256 / 24LC512
    ' EEPROM Setup -----------------------
    
    
    H VAR BYTE        '24LC16B Only
    CCT VAR BYTE      '24LC16B Only
    
    
    ' EEPROM Setup -----------------------
    ' 24LC16B
    'aArray VAR BYTE[16]
    'bArray VAR BYTE[16]
    
    
    ' 24LC64 / 24FC64
    aArray VAR BYTE[32]
    bArray VAR BYTE[32]
    
    
    ' 24LC256
    'aArray VAR BYTE[64]
    'bArray VAR BYTE[64]
    
    
    ' 24LC512
    'aArray VAR BYTE[128]
    'bArray VAR BYTE[128]
    
    
    ' Array Fill Char.
    'For I = 0 To 127       ' 24LC512    65536 - 128 = 65408 Bytes
    'For I = 0 To 63        ' 24LC256    32767 - 64 = 32703 Bytes
    For I = 0 To 31         ' 24LC64     8192 - 32 = 8160 Bytes 
    'For I = 0 To 15        ' 24LC16B    0-255
    
    
        aArray [I] = $FF    'Blank 
    Next I
    ' EEPROM Setup -----------------------
    
    
    Low PORTA.1                            ' Led end job
    MAIN:                                  ' Main Routine
    
    
    While PORTE.3 = 1: Wend                ' Button Press
    PAUSE 100                              ' Bounce delay
    While PORTE.3 = 0: Wend                ' Button release
    PAUSE 100                              ' Bounce delay
    Low PORTA.1
    
    
    ' EEPROM Setup -----------------------
    'FOR H = 0 TO 7    '24LC16B
    '    IF H = 0 THEN cct = $a0
    '    IF H = 1 THEN cct = $a2
    '    IF H = 2 THEN cct = $a4
    '    IF H = 3 THEN cct = $a6
    '    IF H = 4 THEN cct = $a8
    '    IF H = 5 THEN cct = $aa
    '    IF H = 6 THEN cct = $ac
    '    IF H = 7 THEN cct = $ae
    
    
    
    
    'For I = 0  To 65408 STEP 128  '24LC512 
    'For I = 0  To 32704 STEP 64   '24LC256 
    For I = 0  To 8160 Step 32    '24LC64  
    'For I = 0  To 255 Step 16     '24LC16B 
    
    
    '24LC16B OK
    'I2Cwrite PORTC.2, PORTC.1,cct,I, [str aarray\16]  
    'I2Cwrite PORTB.2, PORTB.1,cct,I, [str aarray\16]  
    
    
    '24LC64 OK
    'I2Cwrite PORTC.2, PORTC.1,%10100000,I, [str aarray\32] 
    'I2Cwrite PORTB.2, PORTB.1,$A0,I, [str aarray\32]   
    
    
    
    
    '-----------  24FC64  -------------------------------------
    
    
    '24FC64   SAME 24LC64 
             ' MSSP1
             ' SDA1     SCL1
    'I2Cwrite PORTC.4, PORTC.3,%10100000,I, [str aarray\32]  'PORT not working
             ' MSSP2
             ' SDA2     SCL2
    I2Cwrite PORTB.2, PORTB.1,$A0,I, [str aarray\32]   
    
    
    '-----------  24FC64  -------------------------------------
    
    
    
    
    '24LC256 OK
    'I2Cwrite PORTC.2, PORTC.1,$a0,I, [str aarray\64] 
    'I2Cwrite PORTB.2, PORTB.1,%10100000,I, [str aarray\64] 
    
    
    '24LC512  OK
    'I2Cwrite PORTC.2, PORTC.1,$a0,I, [str aarray\128] 
    'I2Cwrite PORTB.2, PORTB.1,%10100000,I, [str aarray\128]  
    
    
    ' EEPROM Setup -----------------------
    PAUSE 10
    Next I
    ' EEPROM Setup -----------------------
    'NEXT H
    ' EEPROM Setup -----------------------
    'SerOut PORTA.0,84, [" Done    : ",Dec I,13,10]
    High PORTA.1
    GoTo MAIN

  4. #4
    Join Date
    May 2013
    Location
    australia
    Posts
    2,631


    1 out of 1 members found this post helpful. Did you find this post helpful? Yes | No

    Default Re: 24FC64 EEPROM Running at 1Mhz ?

    does the this PIC can work with an 24FC64 AT 1Mhz(sic)
    yes, using mssp hardware i2c no problem


    pbp has no "native" support for hardware ic2 you need to brew you own commands


    https://support.melabs.com/forum/pic...c-hardware-i2c
    Warning I'm not a teacher

  5. #5
    Join Date
    Jan 2022
    Posts
    42


    Did you find this post helpful? Yes | No

    Default Re: 24FC64 EEPROM Running at 1Mhz ?

    Thanks richard.

  6. #6
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    699


    Did you find this post helpful? Yes | No

    Default Re: 24FC64 EEPROM Running at 1Mhz ?

    I have used the I2C commands at 100KHz and 400KHz. I have never used it at 1MHz. I'm not sure if you can use the I2C commands at 1MHz. Below, there is a quote from the PBP help.

    The timing of the I2C instructions is set so than standard speed devices (100KHz) will be accessible at clock speeds up to 8MHz. Fast mode devices (400KHz) may be used up to 20MHz.
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  7. #7
    Join Date
    Jan 2022
    Posts
    42


    Did you find this post helpful? Yes | No

    Default Re: 24FC64 EEPROM Running at 1Mhz ?

    Thanks rsocor01 for the comment,

    all I found was about 100Khz / 400Khz nothing that can run on the MSSP of Microchip 18F series.

    same as I run with PBP3, Positron, Picaxe, I was interested to get an eeprom run at 1 Mhz from the Microchip AN989.

    Using the MSSP Module to Interface I2C Serial EEPROMs with PIC18 Devices dated 2005

    I figure that some of theses compilers will do the trick today in 2025

    But no luck.

    Maybe next year?....




  8. #8
    Join Date
    May 2013
    Location
    australia
    Posts
    2,631


    1 out of 1 members found this post helpful. Did you find this post helpful? Yes | No

    Default Re: 24FC64 EEPROM Running at 1Mhz ?

    I figure that some of theses compilers will do the trick today in 2025


    But no luck.


    Maybe next year?....
    the last time pbp had a new feature added space shuttles still had that new car smell about them

    all the compilers that are not dead in the water already can support use of the mssp module

    the link i posted explains nicely how to brew i2c commands using the mssp module and you can set the speed to 1mhz or even higher

    you can tidy the i2c hardware process up a lot with "usercommand" if you're keen
    Warning I'm not a teacher

  9. #9
    Join Date
    Jan 2022
    Posts
    42


    Did you find this post helpful? Yes | No

    Default Re: 24FC64 EEPROM Running at 1Mhz ?

    Thanks Richard, I was looking if I made a mistake in my code, and get some help, sure the avenue of building the I2C, as you mention

    it's interresting, I'll look at it see if I can get some result, also the test was made with an 24LC64, probably 400Khz,

    the FC64 at 5Vcc, should run a 1Mhz , my assumption was that maybe my SFR was not setup properly, now I understand I have to 'Brew"

    like you said my own function.

    Thanks Richard for your advise

    take care.

  10. #10
    Join Date
    Aug 2011
    Posts
    453


    Did you find this post helpful? Yes | No

    Default Re: 24FC64 EEPROM Running at 1Mhz ?

    In order to get 1MHz operation you'll likely have to reduce the SDA/SCL pullups to a lower value than you're typically used to.
    The rise time of the open-drain signals will need to be faster than when you're working at 100K or 400K.

    You might also consider an I2C risetime accelerator IC which will boost the current during the rising edge.
    I've used these up to 800KHz with good success... much faster and the internal logic of the MSSP in the PIC18 tends to generate a bus collision (BCLIF) during the START bit.

    If you're looking for a BASIC that supports MSSP operation up to 1MHz you might try Swordfish BASIC https://www.sfcompiler.co.uk/swordfish/

    Since you don't really get a big performance boost running that much faster if you really want speed then switch to an SPI EEPROM.

  11. #11
    Join Date
    Jan 2022
    Posts
    42


    Did you find this post helpful? Yes | No

    Default Re: 24FC64 EEPROM Running at 1Mhz ?

    Hello tumbleweed

    About the resistor I used 2k for 1Mhz as for the AN989 even thought the test was done using an LC on that document.

    It's not so easy to get the FC serie running from PBP3, so I'll stick to 400Khz.

    thanks for your advice,



Similar Threads

  1. Replies: 8
    Last Post: - 28th January 2014, 14:21
  2. How to define OSC for vlaues below 1mhz? so you get the timing correct.
    By ofuzzy1 in forum FAQ - Frequently Asked Questions
    Replies: 1
    Last Post: - 3rd May 2011, 16:17
  3. Cant get my PIC running
    By Viberer in forum Off Topic
    Replies: 13
    Last Post: - 29th August 2008, 20:07
  4. I’m Running Out of CodeSpace, What Can I Do?
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 0
    Last Post: - 12th July 2004, 19:25

Members who have read this thread : 18

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

Posting Permissions

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