I2C hardware on SuperPRO and PROplus

Questions on control of serial busses
Post Reply
Posts: 1090
Joined: Fri Oct 19, 2012 2:39 am
Location: Weeki Watchee, FL

I2C hardware on SuperPRO and PROplus

Post by basicchip »

>from the help line

>> I am trying to use the hardware I2C in the LPC1751 on the Pro Plus. This code compiles but will not execute.
>> #include <LPC17xx.bas>
>> print I2C2STAT
>> whereas this code will execute.
>> #include <LPC17xx.bas>
>> print FIO2DIR
>> I am using BASICTools. Any ideas about what I am doing wrong?

I had replied there are only 2 active I2Cs, but that does include I2C1 and I2C2.

Back to the user manual, Chapter 19 Basic Configuration for I2C

1. Power: In the PCONP register (Table 46), set bit PCI2C0/1/2.
Remark: On reset, all I2C interfaces are enabled (PCI2C0/1/2 = 1).

While this is true our initialization code does turn off many unused interfaces to save power. I suspect this is the case for the i2c 's. So a quick check of that --

Code: Select all

#include <LPC17xx.bas>
print hex(SCB_PCONP)


And yes bits 19 and 26 are 0, so those are turned off and until turned on will generate a bus error.

Posts: 10
Joined: Sat Nov 09, 2013 2:43 pm

Re: I2C hardware on SuperPRO and PROplus

Post by w0ivj »

Thanks, I turned the power on to both I2C interfaces by writing hex(7C8925E) to SCB_PCONP and now I can read both status registers.

Post Reply