Skip to content

microchip-pic-avr-examples/avr128db48-find-all-i2c-clients-on-bus-callback-printf-errors

Repository files navigation

Microchip Technologies Inc.

AVR128DB48 I2C_Host Example Component for CNano Explorer: Find all I2C Clients on Bus (Callbacks, Printf-errors)

The I2C Host Find all Clients Example, of the MCC Melody I2C Example Component (for the Curiosity Nano Explorer), is used here in the Callbacks implementation, with the Printf with error handling visualization.

alt text

In this example, an I2C write is attempted for all possible I2C client addresses to identify clients that respond with an ACK. This builds up a list of valid I2C_Client addresses on the bus, displaying this as a printf message over the Universal Asynchronous Receiver and Transmitter (UART). The example uses a polled implementation.

As each address is attempted in the Prinft with Error Checking visualization output, an Acknowledge (ACK) or No-Acknowledge (NACK) message is printed over the UART.

When using the MPLAB® Data Visualizer, after configuring the Terminal to a baudrate of 115200 and clicking to 'display as text in the terminal' he example will display as follows.

The following image of the MPLAB Data Visualizer shows the application running on the Curiosity Nano Explorer board, where ten client devices have been found:

alt text

Setup

The following outlines the complete MCC Melody configuration, including all the selected tasks that have been implemented in this example, as seen in the MPLAB Code Configurator (MCC) Melody Builder.

alt text

alt text

MCC Melody Example Components

Example Components are a tight integration of learning material directly into MCC. This allows users to conveniently place the configuration instructions side-by-side to the components they are configuring. For more information, refer to the MCC Melody Example Components introduction.

Related Documentation

Software Used

  • MPLAB® X IDE v6.25 or newer

  • MPLAB® XC8 v3.00 or newer

  • MPLAB® Code Configurator (MCC) Plug-in Version v5.6.2 or newer (Tools>Plugins>Installed, search: "MCC")

  • MPLAB® Data Visualizer Plug-in Version v1.4.1926 or newer (Tools>Plugins>Installed, search: "Data Visualizer")

  • MCC Melody I2C_Host Example Component for the Curiosity Nano Explorer 1.0.0 or newer

  • MCC Core v5.8.2 or newer

  • Single Page Application (SPA) Host v1.0.0 or newer

  • MCC Melody Core v2.9.1 or newer

Open the MCC Content Manager CM_icon to verify the MCC Core and MCC Melody Core versions.

alt text

Hardware Used

About

I2C write tried for all client addresses. ACK/NACK printed via UART. On completion, valid I2C addresses with ACK shown in printf message.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •