I'm playing with the STM32L433-Nucleo64 board. As I mentioned in a previous thread, I'm using the STM32L443xx in my board.h since 433 isn't in the registry but shares almost everything with the 443 with the exception of missing the AES peripheral which I'm not touching.
I'm using ChibiOS_18
All has been going well, I've been playing with an SPI lcd screen, and using the (LP)UARTS and new PAL/EXTI drivers.
I enabled I2C1, set it up to clock from HSI16 and used the timing values from the RM based on a 16Mhz clock.
Code: Select all
#define STM32_I2C1SEL STM32_I2C1SEL_HSI16
...
#define STM32_I2C_USE_I2C1 TRUE
#define STM32_I2C_USE_I2C2 FALSE
#define STM32_I2C_USE_I2C3 FALSE
#define STM32_I2C_BUSY_TIMEOUT 50
#define STM32_I2C_I2C1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
#define STM32_I2C_I2C1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
#define STM32_I2C_I2C1_IRQ_PRIORITY 5
#define STM32_I2C_I2C1_DMA_PRIORITY 3
then attempt read 128 bytes from an EEPROM by running the following:
Code: Select all
static std::array< uint8_t, 128 > data;
static std::array< uint8_t, 2 > cmd;
...
int main( void ) {
palSetPadMode(GPIOB, 8, PAL_MODE_ALTERNATE(4) | PAL_STM32_PUPDR_PULLUP |
PAL_STM32_OSPEED_HIGH);
palSetPadMode(GPIOB, 7, PAL_MODE_ALTERNATE(4) | PAL_STM32_PUPDR_PULLUP |
PAL_STM32_OSPEED_HIGH);
i2cStart(&I2CD1, &i2cconfig);
cmd[0] = 0;
cmd[1] = 0;
auto msg = i2cMasterTransmitTimeout( &I2CD1, 0xa0, &cmd[0], sizeof(cmd),
&data[0], sizeof(data),
TIME_MS2I( 50 ));
while( 1 ) { chThdSleepMilliseconds(500); }
}
When it reaches the point in os/hal/ports/STM32/LLD/I2Cv2/hal_i2c_lld.c where it writes CR2 (line 195 in function i2c_lld_setup_tx_transfer()) the wheels completely come off and openOCD loses contact with the target.
I'm not sure what I might be doing wrong, I tried the obvious, I enabled the DBG checks that are usually the first line of defense but didn't see anything. There doesn't seem to be a DMA conflict, and moreover, I've disabled all my other code and I2C1 should be the only peripheral started right now.
Any hints are appreciated.
Dave