I2C cannot write to TX_SADDR
#1
Hey everyone 

I am trying to set up an I2C on my NEXYS 4 board without using the rt api from the sdk.
Now I think I have understood the way how the uDMA works an I am also able to transmitt something over the I2C (clock is there and a signal on the SDA is there too), but this are 
not the data I wanted to transfer.

My main problem now is, I am not able to write the address of my TX buffer to the TX_SADDR register. In the manual I can see that the TX_SADDR should be a read/write register but writing to it seams not be possible.
Does someone know what the problem could be or is there maybe an example how to setup peripherals connected to the uDMA without the help of the rt api?

Would really appreciate your help.

Thank you very much and have a nice day.

Code:
//in a headerfile called pulpissimo.h
#define I2C0_RX_SADDR    (*((volatile uint32_t *)0x1A102180))
#define I2C0_RX_SIZE    (*((volatile uint32_t *)0x1A102184))
#define I2C0_RX_CFG    (*((volatile uint32_t *)0x1A102188))
#define I2C0_TX_SADDR    (*((volatile uint32_t *)0x1A102190))
#define I2C0_TX_SIZE    (*((volatile uint32_t *)0x1A102194))
#define I2C0_TX_CFG    (*((volatile uint32_t *)0x1A102198))

//in hal_i2c.c
__attribute__((section(".l2_data"))) uint8_t tx_buff[BUFFERSIZE];
__attribute__((section(".l2_data"))) uint8_t rx_buff[BUFFERSIZE];
__attribute__((section(".l2_data"))) uint8_t cmd_buff[BUFFERSIZE];

//in an initialisation function in hal_i2c.c
I2C0_RX_SADDR  |= (uint32_t)&rx_buff[0]; //after this there is 0x00000000 in the register
I2C0_RX_SIZE   |= BUFFERSIZE;            //after this there is 0x00000000 in the register
  
I2C0_TX_SADDR  |= (uint32_t)&tx_buff[0]; //after this there is 0x00000000 in the register
I2C0_TX_SIZE   |= BUFFERSIZE;            //after this there is 0x00000000 in the register

I2C0_CMD_SADDR |= (uint32_t)&cmd_buff[0]; //after this there is 0x00000000 in the register
I2C0_CMD_SIZE  |= BUFFERSIZE;             //after this there is 0x00000000 in the register
Reply


Forum Jump: