We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello, I'm just trying to get started with the development of some software for an Infineon XC161CJ using the uVision2 Toolset. My first attempt was to get a Display via I2C running (161 master, Display Slave, just write on it), so I used Dave to generate a basic Startup-Config and simply used some of its predefines macros to set up the i2C-communication. What other did one expect than this to fail. My problem is I do not know how to debug. I wanted to use the Memory Window of the Debugger and have a look if the Registers are set properly and if I get an acknowledge from the slave, but I do not get any Information from the memory area, where I expect the registers to be. The I2C is initialized by --- IIC_CON = 0x0008; // load I2C system control register -> 7Bit-Addr,Single-Master,Ack active, 1Byte Transmit-Buffer IIC_ADR = 0x0000; // load I2C address control register IIC_CFG = 0x3133; // load I2C bus control register -> 00110001(=49=baudrate prescale) 0(reserved) 011(scl10) 0(reserved) 011(sda10) IIC_ST = 0x0000; // load I2C status register ALTSEL0P9 |= 0x000F; // select alternate output function ALTSEL1P9 |= 0x0001; // select alternate output function DP9 = (DP9 & ~(uword)0x000F) | 0x000F; //set direction register --- when I watch the Memory Window at the corresponding adresses when IIC_CON is written (#define IIC_CON (*((uword volatile *) 0xE602)) I cannot see any changes, even when I change the value by hand in the Memory Window, after the next instruction its reset to the previous value, i.e. 0x0000. Writing and reading to the memory area of standard-io-pins works fine, so it does watching it in the Memory Window of the debugger (for example #define P9 (*((uword volatile *) 0xFF16)) Anyone a suggestion where to start searching for the problem ? Btw. is there any book or manual suitable for beginners ? Thanks a lot for your replys
Thanks for your reply, but that doesn't help me much. It would be a start for me to know how to access a XSFR. Directly adressing a SFR works, but the same for the XSFR seems not, 'cause I cannot see the assignments I made in the Memory Window while debugging and the code does not work. works (can trace this in the Memory window): DP3 = 0xAAAA; //(*((uword volatile*) 0xFFC6)) does not work: IIC_ADR = 0x00FF; //(*((uword volatile *)0xE606)) Even though the Infineon manual says: "Accesses to registers in the XSFR area use 16-bit addresses and require no specific addressing modes or precautions." Can it be, that anything is wrong with the initialization of the I2C-Module and the CPU therefore protects the registers from being written ?
well, I don't know why but I need to reset the controller by hardware after flashing, then start the debug session and then I (most times) get the correct values...