cancel
Showing results for 
Search instead for 
Did you mean: 

Talking to an HT16K33 via I2C

SoCalJim
Associate III

I’m connecting to an HT16K33 (on an Adafruit 4-digit, 7-segment display) to a NUCLEO-H755 board.

I’m connecting I2C4 SCL to PF14 (pin 19 on CN9), and I2C4 SDA to PFf15 (pin 21 on CN9).

Here's my init:

static void MX_I2C4_Init(void)

{

  hi2c4.Instance = I2C4;

  hi2c4.Init.Timing = 0x10707DBC;

  hi2c4.Init.OwnAddress1 = 0;

  hi2c4.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;

  hi2c4.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;

  hi2c4.Init.OwnAddress2 = 0;

  hi2c4.Init.OwnAddress2Masks = I2C_OA2_NOMASK;

  hi2c4.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;

  hi2c4.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;

...

  if (HAL_I2CEx_ConfigAnalogFilter(&hi2c4, I2C_ANALOGFILTER_ENABLE) != HAL_OK)

...

  if (HAL_I2CEx_ConfigDigitalFilter(&hi2c4, 0) != HAL_OK)

...

}

 

I make the following call:

uint8_t buffer[] = {0x00, 0xFF, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

HAL_I2C_Master_Transmit_IT(&hi2c4, 0x70, buffer, sizeof(buffer));

 

I get an error interrupt with a HAL_I2C_ERROR_AF error.

void HAL_I2C_ErrorCallback(I2C_HandleTypeDef *hi2c)

{

       uint32_t lastErrorCode = HAL_I2C_GetError(hi2c);



       if (lastErrorCode & HAL_I2C_ERROR_AF) {

              // ACKF error

              // Not acknowledge received flag

              // This flag is set by hardware when a NACK is received after a byte transmission. It is cleared

              // by software by setting the NACKCF bit.

              __BKPT(0);

       }



       __BKPT(0);

}

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

Try a slave address of 0x70 << 1 (0xE0). Needs to be left-shifted.

TDK_0-1742265024634.png

 

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

2 REPLIES 2
TDK
Guru

Try a slave address of 0x70 << 1 (0xE0). Needs to be left-shifted.

TDK_0-1742265024634.png

 

If you feel a post has answered your question, please click "Accept as Solution".

Thank you!!!