LPC_SYSCON -> SYSAHBCLKCTRL |= (1 << 5); LPC_I2C -> CONSET |= (1 << 6);//config CONSET (MASTER OR SLAVE) LPC_IOCON -> PIO0_10 |= (1 << 2);//SCL config LPC_IOCON -> PIO0_11 |= (1 << 2); //SDA config |
#ifdef __USE_CMSIS #include "LPC122x.h" #include "IO.h" //#include "lcd.h" #endif #include <cr_section_macros.h> #include <NXP/crp.h> int k = 0; uint16_t bits[10]; void I2CInit(){ LPC_SYSCON -> SYSAHBCLKCTRL = (1 << 5); LPC_I2C -> CONSET = (1 << 6);//config CONSET (MASTER OR SLAVE) LPC_IOCON -> PIO0_10 = (1 << 2);//SCL config LPC_IOCON -> PIO0_11 = (1 << 2); //sdA CONFIG } void I2CSend(uint8_t bit){ //LPC_I2C -> CONSET = (1 << 5); LPC_I2C -> DAT = bit; } void DataSet(){ bits[0] = 0xA2; //slave addres bits[1] = 0x0;//set pointer to zero position in register bits[2] = 0x2;//set 12hour mode and 7pF quartz //-************************************************************************ bits[3] = 0x4;//set pointer to a second register bits[4] = 0;//sekunde bits[5] = 0x45;//minute bits[6] = 0x23;//hour bits[7] = 0x15;//days bits[8] =0x4;//weekdays bits[9] = 0x12; //month bits[10] = 0x11;//year } int main(void) { DataSet(); I2CInit(); //start condition LPC_I2C -> CONSET = (1 << 5); for(k = 0; k <= 2; k++){ I2CSend(bits[k]); } //restart condition LPC_I2C -> CONSET = (1 << 5); I2CSend(bits[0]); for(k = 2; k <= 10; k++){ I2CSend(bits[k]); } LPC_I2C -> CONSET = (0 << 5) | (1 << 4); while (1) { } } |
05db2380: Failed to execute MI command: -data-disassemble -s 98247552 -e 98247660 -- 3 Error message from debugger back end: Cannot access memory at address 0x5db2380 |
LPCXpresso Debug Driver v7.8 (May 28 2015 02:56:34 - crt_emu_lpc11_13_nxp build 181) Emu(0): Conn&Reset. CpuID: 410CC200. Info: HID64HS12 Debug protocol: SWD Frequency 3000 KHz. RTCK: Disabled. Vector catch: Disabled. loaded v.2 On-chip Flash Memory LPC11_12_13_128K_8K.cfx image 'LPC11_12_13 (128K Flash, min 8K RAM) May 21 2015 09:32:41' NXP: LPC1227/301 Part ID: 0x00000000 Connected: was_reset=false. was_stopped=false LPCXpresso Free License - Download limit is 256K code (at 0x10000000) not set as written - corrupted at 0x10000000 (word 0) 10000000: 23010020 54000045 00001032 10000000 ..#E..T2....... 10000010: 0000036c 10000430 00001000 10000430 l...0.......0... 10000020: 000000c0 00000000 100002fc 10000035 ............5... 10000030: 00000000 b6721c04 f854f000 1c062300 ......r...T..#.. 10000040: 61636020 8f5ff3bf 2d006965 2300d0fa `ca.._.ei.-...# 10000050: 429e6123 6026d002 e0363340 d504072b #a.B..&`@36.+... 10000060: 68e16860 f880f000 06ebe026 4b1bd507 `h.h....&......K 10000070: d1012b00 e01f2000 f852f000 2342e01c .+... ....R...B# 10000080: d012421d d40807ab 2b004b15 6860d0f2 .B.......K.+..`h 10000090: 68a268e1 f8e0f000 6860e00e 68a268e1 .h.h......`h.h.h 100000A0: f894f000 d0ef2800 23c0e006 421d005b .....(.....#[..B 100000B0: f000d004 1c30f833 e0012300 23021c28 ....3.0..#..(..# 100000C0: 28006020 2201d001 61234313 61632300 `.(...".C#a.#ca 100000D0: 33ff3301 d1b5429d 46c0e7fe 10000121 .3.3.B.....F!... 100000E0: 10000259 4b072000 601a4a07 4a084b07 Y.... .K.J.`.K.J 100000F0: 23016018 60136010 60134a06 4b062202 .`.#.`.`.J.`.".K 10000000: 00000000 00000000 00000000 00000000 ................ 10000010: 00000000 00000000 00000000 00000000 ................ 10000020: 00000000 00000000 00000000 00000000 ................ 10000030: 00000000 00000000 00000000 00000000 ................ 10000040: 00000000 00000000 00000000 00000000 ................ 10000050: 00000000 00000000 00000000 00000000 ................ 10000060: 00000000 00000000 00000000 00000000 ................ 10000070: 00000000 00000000 00000000 00000000 ................ 10000080: 00000000 00000000 00000000 00000000 ................ 10000090: 00000000 00000000 00000000 00000000 ................ 100000A0: 00000000 00000000 00000000 00000000 ................ 100000B0: 00000000 00000000 00000000 00000000 ................ 100000C0: 00000000 00000000 00000000 00000000 ................ 100000D0: 00000000 00000000 00000000 00000000 ................ 100000E0: 00000000 00000000 00000000 00000000 ................ 100000F0: 00000000 00000000 00000000 00000000 ................ Target error from Commit Flash write: Ef(50): Flash driver failed to initialize (crt_emu_lpc11_13_nxp) terminating due to request from GDB SWD Frequency (Final): 3000 KHz. |