• AVR Freaks

Hot!I2C Harmony 2.06

Author
nich2011
New Member
  • Total Posts : 16
  • Reward points : 0
  • Joined: 2018/03/05 18:24:51
  • Location: 0
  • Status: offline
2020/02/07 01:31:55 (permalink)
0

I2C Harmony 2.06

Hi,
 
I2C port 1 = slave
I2C port 2 = master
I am trying to setup a slave I2C using PIC32MZ2048EFG144 with a few other ports acting as masters.
So, basically the slave would receive I2C transactions from an external master, process it and execute on port 2. Port 2 has its own state machine operation will be time consuming and I would like Port 1 slave to only transmit when port 2 master operation is completed. Any idea how make the slave callback function wait for process on port 2 to complete before transmitting through port 1?
 
void APP_I2C_Slave_Transfer_Callback(DRV_I2C_BUFFER_EVENT event, void * context)
{
    switch (event)
    {
        // master sends data to slave I2C1
        case DRV_I2C_BUFFER_SLAVE_READ_REQUESTED:
        {
            app_i2cData.i2c_id_1_buffer_handle = DRV_I2C_Receive(app_i2cData.i2c_id_1_driver_handle, SLAVE_I2C_ADDRESS, app_i2cData.i2c_id_1_RxBuffer, app_i2cData.i2c_id_1_BytesToRead, NULL);
            break;
        }
        
        // master requests data from slave I2C1
        case DRV_I2C_BUFFER_SLAVE_WRITE_REQUESTED:
        {
            app_i2cData.i2c_id_1_state = APP_I2C_ID_1_EXECUTE;
            while (!appData.is_process_complete)
            {
                
            }
 
 
 
            app_i2cData.i2c_id_1_buffer_handle = DRV_I2C_Transmit(app_i2cData.i2c_id_1_driver_handle, SLAVE_I2C_ADDRESS, app_i2cData.i2c_id_1_TxBuffer, app_i2cData.i2c_id_1_BytesToWrite, NULL);
            break;
        }
        
        default:
        {
            break;
        }
    }
}

post edited by nich2011 - 2020/02/16 19:54:43
#1

4 Replies Related Threads

    nich2011
    New Member
    • Total Posts : 16
    • Reward points : 0
    • Joined: 2018/03/05 18:24:51
    • Location: 0
    • Status: offline
    Re: I2C Harmony 2.06 2020/02/11 17:13:29 (permalink)
    0
    BUMP
    #2
    Paul PortSol
    Super Member
    • Total Posts : 563
    • Reward points : 0
    • Joined: 2015/07/03 11:52:03
    • Location: Newfoundland, Canada
    • Status: offline
    Re: I2C Harmony 2.06 2020/02/12 06:14:20 (permalink)
    0
    Haven't done PIC32MZ I2C as Slave,
    only warning I got is make sure you select "software implementation" for PIC32MZ I2C in MHC.
    Paul
    #3
    nich2011
    New Member
    • Total Posts : 16
    • Reward points : 0
    • Joined: 2018/03/05 18:24:51
    • Location: 0
    • Status: offline
    Re: I2C Harmony 2.06 2020/02/12 21:00:54 (permalink)
    0
    BUMP
    #4
    nich2011
    New Member
    • Total Posts : 16
    • Reward points : 0
    • Joined: 2018/03/05 18:24:51
    • Location: 0
    • Status: offline
    Re: I2C Harmony 2.06 2020/02/16 19:55:00 (permalink)
    0
    BUMP
    #5
    Jump to:
    © 2020 APG vNext Commercial Version 4.5