Skip to content

Commit c221c51

Browse files
committed
Move ethernet DMA reset slightly earlier to eliminate freeze on h723
1 parent 4b35e13 commit c221c51

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/ethernet/eth.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,12 @@ pub unsafe fn new_unchecked<const TD: usize, const RD: usize>(
455455
// Ensure syscfg is enabled (for PMCR)
456456
rcc.apb4enr.modify(|_, w| w.syscfgen().set_bit());
457457

458+
// Reset ETH_DMA - write 1 and wait for 0.
459+
// On the H723, we have to do this before prec.enable()
460+
// or the DMA will never come out of reset
461+
eth_dma.dmamr.modify(|_, w| w.swr().set_bit());
462+
while eth_dma.dmamr.read().swr().bit_is_set() {}
463+
458464
// AHB1 ETH1MACEN
459465
prec.enable();
460466

@@ -465,16 +471,14 @@ pub unsafe fn new_unchecked<const TD: usize, const RD: usize>(
465471
.modify(|_, w| w.eth1txen().set_bit().eth1rxen().set_bit());
466472

467473
syscfg.pmcr.modify(|_, w| w.epis().bits(0b100)); // RMII
474+
468475
}
469476

470477
// reset ETH_MAC - write 1 then 0
471478
//rcc.ahb1rstr.modify(|_, w| w.eth1macrst().set_bit());
472479
//rcc.ahb1rstr.modify(|_, w| w.eth1macrst().clear_bit());
473480

474481
cortex_m::interrupt::free(|_cs| {
475-
// reset ETH_DMA - write 1 and wait for 0
476-
eth_dma.dmamr.modify(|_, w| w.swr().set_bit());
477-
while eth_dma.dmamr.read().swr().bit_is_set() {}
478482

479483
// 200 MHz
480484
eth_mac

0 commit comments

Comments
 (0)