Quantcast
Channel: Infineon Forums
Viewing all articles
Browse latest Browse all 9892

xmc 4500 I2C no output and all USIC register appeear as 0xFFFFFF

$
0
0
Hi all!
I've having an issue with my XMC4500 relex kit and usic channel. Here's my code:
Code:

volatile uint8_t tx_completion_0 = 0;

 /* Transmit callback handling */
void tx_callback_0(void)
{
  tx_completion_0 = 1;
}

int main(void)
{
  DAVE_STATUS_t status;
  uint8_t tr1[7] = { OLED_CONTROL_BYTE_CMD_STREAM, OLED_CMD_SET_COLUMN_RANGE, 0x00, 0x7F, OLED_CMD_SET_PAGE_RANGE,0x00, 0x07 };
  status = DAVE_Init();          /* Initialization of DAVE APPs  */
  XMC_DEBUG("here at least?...")
  if(status == DAVE_STATUS_FAILURE)
  {
    /* Placeholder for error handler code. The while loop below can be replaced with an user error handler. */
    XMC_DEBUG("DAVE APPs initialization failed\n");

    while(1U)
    {

    }
  }

  /* Placeholder for user application code. The while loop below can be replaced with user application code. */

  while(1U)
  {

        I2C_MASTER_Transmit(&I2C_MASTER_0, true, OLED_I2C_ADDRESS, tr1, 7, true );
        while(!tx_completion_0);
        tx_completion_0 = 0;

        for(uint16_t i=0;i<1024;i++){
               
                I2C_MASTER_SendStart(&I2C_MASTER_0, OLED_I2C_ADDRESS, XMC_I2C_CH_CMD_WRITE);
                I2C_MASTER_TransmitByte(&I2C_MASTER_0, OLED_CONTROL_BYTE_DATA_STREAM);
                while(!tx_completion_0);
                tx_completion_0 = 0;
                  for (uint8_t x=0; x<16; x++) {
                          I2C_MASTER_TransmitByte(&I2C_MASTER_0, 0x81);
                          while(!tx_completion_0);
                          tx_completion_0 = 0;
                          i++;
                  }
                  I2C_MASTER_SendStop(&I2C_MASTER_0);
          }
  }
}

As you can see it's almost a copy from the I2C example, but still doesn't give me any output ( I configured the end of transmit callback to be function tx_callback_0 and the pins to be SCl:0.8 and SDA:1.5)
and in the debugger when I lock at USIC0_C0 address I find all ones
Attachment 2573

Thanks in advance!
Attached Images

Viewing all articles
Browse latest Browse all 9892

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>