<p>laforge has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/simtrace2/+/24530">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">octsimtest: Adjust VCC voltage thresholds (resistive VCC divider)<br><br>octsimtest has a resistive voltage divider in front of the VCC ADC<br>in order to also detect 5V.  We must make the thresholds board-specific<br>and adjust them for octsimtest.<br><br>Change-Id: I9e4adb4f349d2d838ea4100eb49271f3a0e7a2a5<br>---<br>M firmware/libboard/octsimtest/include/board.h<br>M firmware/libboard/qmod/include/board.h<br>M firmware/libcommon/source/mode_cardemu.c<br>3 files changed, 11 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/30/24530/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/firmware/libboard/octsimtest/include/board.h b/firmware/libboard/octsimtest/include/board.h</span><br><span>index 361c180..2d8a896 100644</span><br><span>--- a/firmware/libboard/octsimtest/include/board.h</span><br><span>+++ b/firmware/libboard/octsimtest/include/board.h</span><br><span>@@ -105,6 +105,9 @@</span><br><span> #define BOARD_USB_BMATTRIBUTES       USBConfigurationDescriptor_BUSPOWERED_NORWAKEUP</span><br><span> </span><br><span> #define DETECT_VCC_BY_ADC</span><br><span style="color: hsl(120, 100%, 40%);">+/* we have a resistive voltage divider of 47 + 30 kOhms to also detect 5V supply power */</span><br><span style="color: hsl(120, 100%, 40%);">+#define VCC_UV_THRESH_1V8  (1500000*47)/(47+30)</span><br><span style="color: hsl(120, 100%, 40%);">+#define VCC_UV_THRESH_3V  (2500000*47)/(47+30)</span><br><span> </span><br><span> /** Supported modes */</span><br><span> /* SIMtrace board supports sniffer mode */</span><br><span>diff --git a/firmware/libboard/qmod/include/board.h b/firmware/libboard/qmod/include/board.h</span><br><span>index 5165434..0d35bef 100644</span><br><span>--- a/firmware/libboard/qmod/include/board.h</span><br><span>+++ b/firmware/libboard/qmod/include/board.h</span><br><span>@@ -109,6 +109,9 @@</span><br><span> #define BOARD_USB_RELEASE        0x010</span><br><span> </span><br><span> #define CARDEMU_SECOND_UART</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> #define DETECT_VCC_BY_ADC</span><br><span style="color: hsl(120, 100%, 40%);">+#define VCC_UV_THRESH_1V8      1500000</span><br><span style="color: hsl(120, 100%, 40%);">+#define VCC_UV_THRESH_3V       2500000</span><br><span> </span><br><span> #define HAVE_CARDEM</span><br><span>diff --git a/firmware/libcommon/source/mode_cardemu.c b/firmware/libcommon/source/mode_cardemu.c</span><br><span>index 604c66a..23f9f66 100644</span><br><span>--- a/firmware/libcommon/source/mode_cardemu.c</span><br><span>+++ b/firmware/libcommon/source/mode_cardemu.c</span><br><span>@@ -408,6 +408,9 @@</span><br><span>  ***********************************************************************/</span><br><span> </span><br><span> #ifdef DETECT_VCC_BY_ADC</span><br><span style="color: hsl(120, 100%, 40%);">+#if !defined(VCC_UV_THRESH_1V8) || !defined(VCC_UV_THRESH_3V)</span><br><span style="color: hsl(120, 100%, 40%);">+#error "You must define VCC_UV_THRESH_{1V1,3V} if you use ADC VCC detection"</span><br><span style="color: hsl(120, 100%, 40%);">+#endif</span><br><span> </span><br><span> static volatile int adc_triggered = 0;</span><br><span> static int adc_sam3s_reva_errata = 0;</span><br><span>@@ -456,8 +459,8 @@</span><br><span>       return 0;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-#define VCC_UV_THRESH_1V8     1500000</span><br><span style="color: hsl(0, 100%, 40%);">-#define VCC_UV_THRESH_3V 2500000</span><br><span style="color: hsl(120, 100%, 40%);">+#define VCC_UV_THRESH_1V8      (1500000/(47+30)*47)</span><br><span style="color: hsl(120, 100%, 40%);">+#define VCC_UV_THRESH_3V  (2500000/(47+30)*47)</span><br><span> </span><br><span> static void process_vcc_adc(struct cardem_inst *ci)</span><br><span> {</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/simtrace2/+/24530">change 24530</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/c/simtrace2/+/24530"/><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-Change-Id: I9e4adb4f349d2d838ea4100eb49271f3a0e7a2a5 </div>
<div style="display:none"> Gerrit-Change-Number: 24530 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>