Internal Command Error STM32F303RE
I'm having this problem when I'm trying to upload my code to the microcontroller.
I'm using the STM32F303RE Nucleo board, and whenever I try to upload the code it happens this error:
Internal command error
And after that, it doesn't let me upload any code. I searched for the solution and it was to erase the code putting BOOT0 in high, but I tried again and failed.
I have this initialization (before the while loop) function for the I2C protocol:
void Initializate_I2C(){
//using AF4
periph::GPIO::set_pin(GPIOA, 14, ALTERNATE); //SDA
periph::GPIO::set_pin(GPIOA, 15, ALTERNATE); //SCL
GPIOA->OTYPER |= ((1U << 14U) | (1U << 15U));
GPIOA->AFR[1] |= (4U << 28U);
GPIOA->AFR[1] |= (4U << 24U);
//periph::GPIO::set_afrh(GPIOA, 4U, 24U);
//periph::GPIO::set_afrh(GPIOA, 4U, 28U);
periph::I2C::Init(I2C1, 0x00201D2BU, FILTER_COF_1);
}I noticed that the code only uploads successfully if I delete lines 8 and 9 (configuring the afrh for I2C). Otherwise, the Internal command error happens.
I updated the st-link since that's the only solution I could find on the internet, but it didn't work.
Thanks for your answer.