<p>Harald Welte <strong>merged</strong> this change.</p><p><a href="https://gerrit.osmocom.org/9912">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Jenkins Builder: Verified
Harald Welte: Looks good to me, approved
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">DFU: re-enable UART after testing forced bootloader<br><br>The qmod does not have a separate force button as simtrace has.<br>Instead it check is TX and RX of UART are shorted using PIO.<br>If the pins are not set back to the UART peripheral, the TRACE/debug<br>console output will not work anymore.<br><br>Change-Id: Id434b49909d6395a2f93a00f39d2d770a5725466<br>---<br>M firmware/libboard/qmod/source/board_qmod.c<br>1 file changed, 20 insertions(+), 8 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/firmware/libboard/qmod/source/board_qmod.c b/firmware/libboard/qmod/source/board_qmod.c</span><br><span>index dd6e616..0eda1ef 100644</span><br><span>--- a/firmware/libboard/qmod/source/board_qmod.c</span><br><span>+++ b/firmware/libboard/qmod/source/board_qmod.c</span><br><span>@@ -261,20 +261,32 @@</span><br><span> /* Configure UART pins as I/O */</span><br><span> PIO_Configure(uart_loopback_pins, PIO_LISTSIZE(uart_loopback_pins));</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ /* Send pattern over UART TX and check if it is received on RX</span><br><span style="color: hsl(120, 100%, 40%);">+ * If the loop doesn't get interrupted, RxD always follows TxD and thus a</span><br><span style="color: hsl(120, 100%, 40%);">+ * loopback jumper has been placed on RxD/TxD, and we will boot</span><br><span style="color: hsl(120, 100%, 40%);">+ * into DFU unconditionally</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+ int has_loopback_jumper = 1;</span><br><span> for (i = 0; i < 10; i++) {</span><br><span> /* Set TxD high; abort if RxD doesn't go high either */</span><br><span> PIO_Set(&uart_loopback_pins[1]);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!PIO_Get(&uart_loopback_pins[0]))</span><br><span style="color: hsl(0, 100%, 40%);">- return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!PIO_Get(&uart_loopback_pins[0])) {</span><br><span style="color: hsl(120, 100%, 40%);">+ has_loopback_jumper = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+ break;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> /* Set TxD low, abort if RxD doesn't go low either */</span><br><span> PIO_Clear(&uart_loopback_pins[1]);</span><br><span style="color: hsl(0, 100%, 40%);">- if (PIO_Get(&uart_loopback_pins[0]))</span><br><span style="color: hsl(0, 100%, 40%);">- return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+ if (PIO_Get(&uart_loopback_pins[0])) {</span><br><span style="color: hsl(120, 100%, 40%);">+ has_loopback_jumper = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+ break;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- /* if we reached here, RxD always follows TxD and thus a</span><br><span style="color: hsl(0, 100%, 40%);">- * loopback jumper has been placed on RxD/TxD, and we will boot</span><br><span style="color: hsl(0, 100%, 40%);">- * into DFU unconditionally */</span><br><span style="color: hsl(0, 100%, 40%);">- return 1;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Put pins back to UART mode */</span><br><span style="color: hsl(120, 100%, 40%);">+ const Pin uart_pins[] = {PINS_UART};</span><br><span style="color: hsl(120, 100%, 40%);">+ PIO_Configure(uart_pins, PIO_LISTSIZE(uart_pins));</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ return has_loopback_jumper;</span><br><span> }</span><br><span> </span><br><span> int board_override_enter_dfu(void)</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/9912">change 9912</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/9912"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: simtrace2 </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Id434b49909d6395a2f93a00f39d2d770a5725466 </div>
<div style="display:none"> Gerrit-Change-Number: 9912 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Kévin Redon <kredon@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Harald Welte <laforge@gnumonks.org> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>