From 52c089c4dfb4298f2f0d06eea26e85a4d69251cb Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Sat, 13 Aug 2016 16:46:02 -0700 Subject: [PATCH] SGPIO: Hi-Z data bus before setting direction pin. Another tactic to avoid bus contention, however brief. --- firmware/common/baseband_sgpio.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/firmware/common/baseband_sgpio.cpp b/firmware/common/baseband_sgpio.cpp index a718c6fc..a574e81d 100644 --- a/firmware/common/baseband_sgpio.cpp +++ b/firmware/common/baseband_sgpio.cpp @@ -298,10 +298,12 @@ constexpr P_OUT_CFG data_p_out_cfg( void SGPIO::configure(const Direction direction) { disable_all_slice_counters(); - LPC_SGPIO->GPIO_OUTREG = gpio_outreg(direction); - // Set data pins as input, temporarily. LPC_SGPIO->GPIO_OENREG = gpio_oenreg(Direction::Receive); + + // Now that data pins are inputs, safe to change CPLD direction. + LPC_SGPIO->GPIO_OUTREG = gpio_outreg(direction); + LPC_SGPIO->OUT_MUX_CFG[ 8] = out_mux_cfg(P_OUT_CFG::DOUT_DOUTM1, P_OE_CFG::GPIO_OE); LPC_SGPIO->OUT_MUX_CFG[ 9] = out_mux_cfg(P_OUT_CFG::DOUT_DOUTM1, P_OE_CFG::GPIO_OE); LPC_SGPIO->OUT_MUX_CFG[10] = out_mux_cfg(P_OUT_CFG::GPIO_OUT, P_OE_CFG::GPIO_OE);