diff --git a/mip/driver_stm32.c b/mip/driver_stm32.c index e01858fc..6cb962bf 100644 --- a/mip/driver_stm32.c +++ b/mip/driver_stm32.c @@ -126,7 +126,7 @@ static bool mip_driver_stm32_init(uint8_t *mac, void *userdata) { // Set MDC clock divider. If user told us the value, use it. Otherwise, guess int cr = (d == NULL || d->mdc_cr < 0) ? guess_mdc_cr() : d->mdc_cr; - ETH->MACMIIAR = ((uint32_t)cr & 3) << 2; + ETH->MACMIIAR = ((uint32_t)cr & 7) << 2; // NOTE(cpq): we do not use extended descriptor bit 7, and do not use // hardware checksum. Therefore, descriptor size is 4, not 8 diff --git a/mongoose.c b/mongoose.c index 3de97644..5c567a62 100644 --- a/mongoose.c +++ b/mongoose.c @@ -6133,7 +6133,7 @@ static bool mip_driver_stm32_init(uint8_t *mac, void *userdata) { // Set MDC clock divider. If user told us the value, use it. Otherwise, guess int cr = (d == NULL || d->mdc_cr < 0) ? guess_mdc_cr() : d->mdc_cr; - ETH->MACMIIAR = ((uint32_t)cr & 3) << 2; + ETH->MACMIIAR = ((uint32_t)cr & 7) << 2; // NOTE(cpq): we do not use extended descriptor bit 7, and do not use // hardware checksum. Therefore, descriptor size is 4, not 8