P24 - Hbus2 command/equivalent? (for 2nd I2C module)


+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Junior Member Jimbird's Avatar
    Join Date
    Feb 2012
    Posts
    29
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    1.96 GB

    0 Not allowed!

    Default P24 - Hbus2 command/equivalent? (for 2nd I2C module)

    Hello all,

    I'm in need of some direction/advice/help on how to get a HBus equivalent for the 2nd I2C module (SDA2/SCL2) on a PIC24128GA306.

    Background:
    I'm hitting one wall after another with a project and time is getting short. It's to measure 10 remote thermocouples and also (using 5x SC16IS750) measuring led pulses that are signalling test results - a sort of frequency modulation. About 3 years ago I designed a PIC24FJ128GA306 board that I expected was going to be ideal for this project because of 4xUsart, buffered I2C ports, hmi , rtc etc. This worked well enough for the need then, because I was able to use the BusIn/Out and I2CIn/Out commands. ... but not now.

    A big issue is that the MCP9600 thermocouple chips use clock stretching which means busin/out & I2Cin/out don't work, so I've had to switch to hardware I2C. For a simpler, cleaner test platform I successfully tried the compiler HBus on a microstick II, only to discover when I started moving back to my board the external buffered I2C uses I2C # 2... for which there is no HBus2 command.... and no PPS routing option on either I2C module .

    My pcb does not lend itself to hacking the I2C pins as it's a 64pin QFP and I can't get at tracks as I'd need to, so I really need to use the I2C#2.
    I've made an attempt at editing the hBus2.inc in the include folder to refer to P24 registers etc, and while it compiles, there is no life on the SDA2 and SCL2 pins.

    Has anyone successfully used the 2nd I2C module on a P24 device and would be willing to share the code?

    Les, is the compiler's HBus code accessable somewhere that would allow it to be modified for HBus2 ?

    Thanks for reading my post!

    Ian

Attention

This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

The advertisements we display are relevant to this web site and your browsing history

Please consider supporting us by disabling your ad blocker.


Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

If you can, please report issues in the forum area WebSite / Forum Issues


Thank you for your attention.

  • #2
    Senior Member GAMBOA's Avatar
    Join Date
    Nov 2004
    Posts
    419
    Thumbs Up
    Received: 19
    Given: 0
    Total Downloaded
    203.73 MB

    0 Not allowed!

    Default Re: P24 - Hbus2 command/equivalent? (for 2nd I2C module)

    Hello Ian,

    I used a microcontroller similar to yours PIC24FJ64GA306. But I have never used I2C on it. Use SPI with the Les library for an SPI memory. In any case, make sure you have directed the I2C # 2 device to the correct pins with PPS.

    Regards,
    Gamboa

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #3
    Junior Member Jimbird's Avatar
    Join Date
    Feb 2012
    Posts
    29
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    1.96 GB

    0 Not allowed!

    Default Re: P24 - Hbus2 command/equivalent? (for 2nd I2C module)

    Thanks for the reply Gamboa.

    That's part of the problem - seems there is no PPS available for I2C modules. Otherwise that may have allowed me to use HBus with I2C module 1 and route SDA/SCL to the necessary pins.
    (Other onboard i2c devices would function ok using software i2c , but not the remote ones. I need to keep them separate as the remote ones need to be on 2 switchable channels due to duplicate slave addresses.)

    See from PIC24F Family Reference Manual, section 12.4.2:

    In comparison, some digital only peripheral modules are not currently included in the peripheral
    pin select feature. This is because the peripheral’s function requires special I/O circuitry on a
    specific port and cannot be easily connected to multiple pins. These modules include I2C,
    speciality communication (Ethernet and USB), change notification inputs, RTCC alarm output
    and all modules with analog inputs, such as the A/D Converter.


    I'm stuck with SDA2/SCL2 connecting to remote I2C slaves and need to use clock-stretching compatible control code for which HBus2 command would be ideal.

    Thanks.

    Ian

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #4
    Senior Member GAMBOA's Avatar
    Join Date
    Nov 2004
    Posts
    419
    Thumbs Up
    Received: 19
    Given: 0
    Total Downloaded
    203.73 MB

    0 Not allowed!

    Default Re: P24 - Hbus2 command/equivalent? (for 2nd I2C module)

    Ian,

    I have been checking the datasheet and you are right the I2C devices are not addressed. I have also read the P24 manual and it does not refer to Hbusin2, etc. So at this time the only alternative that depends on you is to implement the commands Hbstart, Hbusout, Hbusin, Hbrestart and Hbstop in a library with procedures.

    I don't know how difficult that can be for you. For me it is a difficult task.

    On the other hand I have been looking at the assembly code generated by the compiler and studying that code can get some clues on how to do things.

    Regards
    Gamboa

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #5
    Junior Member Jimbird's Avatar
    Join Date
    Feb 2012
    Posts
    29
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    1.96 GB

    0 Not allowed!

    Default Re: P24 - Hbus2 command/equivalent? (for 2nd I2C module)

    Hello Gamboa,

    thanks for taking in interest in my query.
    I2C is a good bus to get to grips with as it's so straightforward and 'light' on connections, and so many devices becoming available.

    While I very much agree with what you suggest, my problem is the convergence of multiple issues, so many bits of the project that still need done, and shortage of time, so
    I now am very wary of how I manage the diminishing time. I'm not a 'natural programmer' so code development invariably takes longer than I would wish. I'm already suffering from a shortage of sleep from excessive hours at work.
    It's a shame Hbus2 hasn't made it into the P24 already, but maybe if I can get this project behind me, I may want to come back to this another time when there's less pressure.

    Thanks.

    Regards,
    Ian

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

    Thread Information

    Users Browsing this Thread

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

       

    Similar Threads

    1. Pic18f25k20 + module i2c (pcf8574)
      By Jenny96 in forum Amicus 18
      Replies: 8
      Last Post: 3rd October 2019, 23:59
    2. Replace the PRINT command to use I2C backpack on 1602 LCD
      By towlerg in forum Projects discussion
      Replies: 263
      Last Post: 2nd November 2018, 18:02
    3. Replies: 20
      Last Post: 15th August 2015, 16:13
    4. I2C nack command
      By geoff_c in forum Proton Plus Compiler v3
      Replies: 24
      Last Post: 10th January 2010, 23:19
    5. [SOLVED !] Installing a 2nd (legal) copy of PDS3
      By J. Mark Wolf in forum Proton Plus Compiler v3
      Replies: 7
      Last Post: 28th August 2006, 03:12

    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