Still tinkering with this H743 board. I am running ChibiOS_21.21.4 and attempting to use the I2C3 peripheral. I am running into a weird one, where as soon as I attempt to initiate a transfer, I lose contact with my openocd/stlink and can only recover by power cycling. It seems to be happening as soon as the TCIE bit is set in CR1.
I have:
- tested on two different boards (both STM32H743) and they both do the same thing.
- tested with and without DMA, and they both do the same thing
- tried various ram segments (although when not using DMA I'd expect it to not matter), same outcome.
- tested by leaving the pins un-configured (obviously they wont talk to the outside world, but the peripheral should not care) and this still does the same thing
- checked the device errata and nothing really stuck out.
- tested on a different MCU (STM32H723 vs 743) and the I2C seems to work fine on that MCU
Any suggestions are very welcome, as I'm running out of ideas.
Thanks,
Dave
Code: Select all
#include "ch.h"
#include "hal.h"
const I2CConfig i2c_cfg = {
.timingr = STM32_TIMINGR_PRESC(0xB) |
STM32_TIMINGR_SCLDEL(0x4) | STM32_TIMINGR_SDADEL(0x2) |
STM32_TIMINGR_SCLH(0xF) | STM32_TIMINGR_SCLL(0x13),
.cr1 = 0,
.cr2 = 0,
};
static const SerialConfig uart_config = {
.speed = 9600,
.cr1 = 0,
.cr2 = 0,
.cr3 = 0,
};
static uint8_t __nocache_buf[2];
int main(void) {
halInit();
chSysInit();
SCB_DisableDCache();
sdStart( &SD1, &uart_config );
sdWrite( &SD1, (const uint8_t*)"test\r\n", 6 );
{
i2cStart( &I2CD3, &i2c_cfg );
__nocache_buf[0] = 0x06;
__nocache_buf[1] = 0x0f;
uint8_t rx[1];
sdRead( &SD1, &rx[0], 1 );
chThdSleepMilliseconds( 10000 );
const uint8_t addr = 0x20;
i2cMasterTransmitTimeout( &I2CD3, addr,
&__nocache_buf[0], sizeof( __nocache_buf ),
0x0, 0,
1000 );
}
sdWrite( &SD1, (const uint8_t*)"done\r\n", 6 );
while(1) {
chThdSleepMilliseconds(1);
}
}