# P2 with MCP39F521

**URL:** <https://community.particle.io/t/p2-with-mcp39f521/64497>\
**Category:** Firmware\
**Created:** [May 4, 2023, 4:23pm UTC](https://community.particle.io/t/p2-with-mcp39f521/64497 "2023-05-04T16:23:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![armor](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/armor/32/18398_2.png) [@armor](https://community.particle.io/u/armor)\
**Post date:** [May 4, 2023, 4:23pm UTC](https://community.particle.io/t/p2-with-mcp39f521/64497/1 "2023-05-04T16:23:14Z")

</div>

I have been trying to get the Smart Plug demo project tutorial to work - using an MCP39F521 demo board with a P2 Eval board to read power (and other things). Unfortunately, I have hit the problems with Wire /I2C that others have hit: [I2C requestFrom gives 0 available bytes](https://community.particle.io/t/i2c-requestfrom-gives-0-available-bytes/63220) and [MCP32F521 Library Port to Particle](https://community.particle.io/t/mcp32f521-library-port-to-particle/56952) now both closed threads. Just wondering if the tutorial did actually work and if it did, what was the secret sauce to allow I2C comms with the MCP39F521? All my attempts result in C5 FF FF…FF being read back from this IC.

---

<div class="post-metadata">

**Author:** ![sridhar\_rajagopal](https://avatars.discourse-cdn.com/v4/letter/s/c4cdca/32.png) [@sridhar\_rajagopal](https://community.particle.io/u/sridhar_rajagopal)\
**Post date:** [October 24, 2023, 10:55pm UTC](https://community.particle.io/t/p2-with-mcp39f521/64497/2 "2023-10-24T22:55:08Z")

</div>

Hi!

Just came across this as the notification email got delivered to my "Promotions" folder/tab!

I had specified the workaround I used in the [I2C requestFrom gives 0 available bytes](https://community.particle.io/t/i2c-requestfrom-gives-0-available-bytes/63220) thread - see around Sept 22. I had to either call requestFrom twice (the first time with a small timeout), or call Wire.reset after endTransmission. From my investigation, the I2C\_FLAG\_BUSY was never getting reset, causing the protocol to hang. Called requestFrom with the small timeout, or the Wire.reset helped to clear the flag and keep things moving. The problem appeared to trickle down to deeper within HAL code and I couldn't dig down the source of the bug.

Hope that helps!  
Sridhar

---

<div class="post-metadata">

**Author:** ![armor](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/armor/32/18398_2.png) [@armor](https://community.particle.io/u/armor)\
**Post date:** [October 25, 2023, 12:08pm UTC](https://community.particle.io/t/p2-with-mcp39f521/64497/3 "2023-10-25T12:08:28Z")

</div>

@sridhar_rajagopal Many thanks - I will try that out.

I haven't retried with the latest Device OS for P2, I know there have been fixes for I2C.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/particle/original/3X/3/2/3291e3c9351789fe8620ae5bcec8d3fec67ff221.png) [@system](https://community.particle.io/u/system)\
**Post date:** [April 25, 2024, 12:08am UTC](https://community.particle.io/t/p2-with-mcp39f521/64497/4 "2024-04-25T00:08:40Z")

</div>

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
