From 62d2ae2336bd847412dd80562e900adb81af951f Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Sat, 13 Aug 2016 16:42:39 -0700 Subject: [PATCH] SGPIO: Change bus direction more deliberately. There may have been an instant where the CPLD and SGPIO were driving the bus simultaneously, when switching from TX to RX. --- firmware/common/baseband_sgpio.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/firmware/common/baseband_sgpio.cpp b/firmware/common/baseband_sgpio.cpp index e4554e96..a718c6fc 100644 --- a/firmware/common/baseband_sgpio.cpp +++ b/firmware/common/baseband_sgpio.cpp @@ -299,7 +299,9 @@ void SGPIO::configure(const Direction direction) { disable_all_slice_counters(); LPC_SGPIO->GPIO_OUTREG = gpio_outreg(direction); - LPC_SGPIO->GPIO_OENREG = gpio_oenreg(direction); + + // Set data pins as input, temporarily. + LPC_SGPIO->GPIO_OENREG = gpio_oenreg(Direction::Receive); 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); @@ -314,6 +316,9 @@ void SGPIO::configure(const Direction direction) { LPC_SGPIO->OUT_MUX_CFG[i] = data_out_mux_cfg; } + // Now that output enable sources are set, enable data bus in correct direction. + LPC_SGPIO->GPIO_OENREG = gpio_oenreg(direction); + const auto slice_gpdma = Slice::H; const size_t slice_count = slice_mode_multislice ? 8 : 1;