I have the OM40002 Dev board.
The problem I see is that, when attaching a logic probe to SDA and SCL, I just see both lines as perpetually high. (I am using the maximum sample rate on my probe of 48MHz).
Here is my code:
#include "LPC8N04.h"
#define I2C_CLOCK (1u << 5)
int main(void) {
// Init pins
IOCON->PIO[0][4] = 1u; // SCL
IOCON->PIO[0][5] = 1u; // SDA
// Init clocks
SYSCON->SYSCLKCTRL &= ~0b1110u; // SYSCLKDIV = 0 => 8MHz
SYSCON->SYSCLKUEN &= ~1u; // Update system clock source
SYSCON->SYSCLKUEN |= 1u;
SYSCON->WDTCLKDIV = 1;
SYSCON->SYSAHBCLKCTRL |= I2C_CLOCK;
SYSCON->PRESETCTRL |= 0b10;
I2C0->CONCLR = 0b01101100;
I2C0->SCLH = 80; // 8 MHz / 80 = 100 kHz
I2C0->SCLL = 80;
I2C0->CONSET = 0b01000000; // I2EN
I2C0->CONSET = I2C0_CONSET_STA_MASK; // START
while (!(I2C0->CONSET & I2C0_CONSET_SI_MASK)) // Wait
;
I2C0->DAT = 0xAE; // Send slave addr
while (!(I2C0->CONSET & I2C0_CONSET_SI_MASK)) // Wait
;
I2C0->CONCLR |= (1 << 3);
while (!(I2C0->CONSET & I2C0_CONSET_SI_MASK)) // Wait
;
while (1) {
}
}Debugging shows that the program spins forever on the second to last while loop (just after CONCLR)
I have split the board in two and wired the 6 debug pins between the two halves since I thought that the connection to the LED array could cause problems.
I have wired P4-1 (PIO0_4/SCL) and P4-3 (PIO0_5/SDA) to P4-5 (VCC) via pull up resistors.
I have tried pull up resistors from 1k to 100k and get the same result.
I have tried running both with and without a slave device connected.
Nothing I have tried has caused any output on SDA or SCL.
I have tried multiple methods of compiling and flashing the code, including just creating a new project in mcuexpresso with default options and just changing the main method to the above.
Hello @TheOrangeTeaFrog
BR
Alice