Porównaj commity

...

6 Commity

6 zmienionych plików z 75 dodań i 62 usunięć

Wyświetl plik

@ -129,8 +129,8 @@
<listOptionValue builtIn="false" value="KISS_LOGGING"/>
<listOptionValue builtIn="false" value="STM32L433xx"/>
</option>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.std.2118376960" name="Language standard" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.std" useByScannerDiscovery="true" value="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.std.gnucpp1z" valueType="enumerated"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.abiversion.667020717" name="ABI version" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.abiversion" useByScannerDiscovery="true" value="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.abiversion.9" valueType="enumerated"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.std.2118376960" name="Language standard" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.std" useByScannerDiscovery="true" value="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.std.gnucpp17" valueType="enumerated"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.abiversion.667020717" name="ABI version" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.abiversion" useByScannerDiscovery="true" value="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.abiversion.13" valueType="enumerated"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.noexceptions.1516078438" name="Do not use exceptions (-fno-exceptions)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.noexceptions" useByScannerDiscovery="true" value="true" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.nortti.1664770922" name="Do not use RTTI (-fno-rtti)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.nortti" useByScannerDiscovery="true" value="true" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.nousecxaatexit.346113747" name="Do not use _cxa_atexit() (-fno-use-cxa-atexit)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.nousecxaatexit" useByScannerDiscovery="true" value="true" valueType="boolean"/>
@ -209,7 +209,7 @@
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.format.1846377208" name="Debug format" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.format" useByScannerDiscovery="true"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.name.1836228229" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.name" useByScannerDiscovery="false" value="GNU Tools for ARM Embedded Processors" valueType="string"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.1755004022" name="Architecture" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.architecture" useByScannerDiscovery="false" value="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.arm" valueType="enumerated"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.family.182753231" name="ARM family" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.family" useByScannerDiscovery="false" value="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.mcpu.cortex-m4" valueType="enumerated"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.family.182753231" name="ARM family (-mcpu)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.family" useByScannerDiscovery="false" value="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.mcpu.cortex-m4" valueType="enumerated"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.instructionset.749685852" name="Instruction set" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.instructionset" useByScannerDiscovery="false" value="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.instructionset.thumb" valueType="enumerated"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.prefix.910306496" name="Prefix" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.prefix" useByScannerDiscovery="false" value="arm-none-eabi-" valueType="string"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.c.2124360754" name="C compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.c" useByScannerDiscovery="false" value="gcc" valueType="string"/>
@ -238,7 +238,7 @@
<builder autoBuildTarget="all" buildPath="${workspace_loc:/TNC3-firmware}/ARM Debug" cleanBuildTarget="clean" command="${cross_make}" enableAutoBuild="true" id="org.eclipse.cdt.build.core.internal.builder.2110076473" incrementalBuildTarget="all" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="CDT Internal Builder" parallelBuildOn="false" superClass="org.eclipse.cdt.build.core.internal.builder"/>
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.1093600654" name="GNU ARM Cross Assembler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler">
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor.1179297555" name="Use preprocessor" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor" useByScannerDiscovery="false" value="true" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.include.paths.1845769595" name="Include paths (-I)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.include.paths" useByScannerDiscovery="true" valueType="includePath">
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.include.paths.1845769595" name="Include paths (-I)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.include.paths" useByScannerDiscovery="true" valueType="includePath">
<listOptionValue builtIn="false" value="/usr/arm-none-eabi/include"/>
<listOptionValue builtIn="false" value="../Drivers/STM32L4xx_HAL_Driver/Inc"/>
<listOptionValue builtIn="false" value="../Inc"/>
@ -251,7 +251,7 @@
<listOptionValue builtIn="false" value="../Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc/"/>
<listOptionValue builtIn="false" value="../Middlewares/ST/STM32_USB_Device_Library/Core/Inc"/>
</option>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.defs.208015513" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.defs" useByScannerDiscovery="true" valueType="definedSymbols">
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.defs.208015513" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.defs" useByScannerDiscovery="true" valueType="definedSymbols">
<listOptionValue builtIn="false" value="__FPU_PRESENT=1"/>
<listOptionValue builtIn="false" value="USE_HAL_DRIVER"/>
<listOptionValue builtIn="false" value="ARM_MATH_CM4"/>
@ -261,7 +261,7 @@
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input.1462552668" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input"/>
</tool>
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.2037524494" name="GNU ARM Cross C Compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler">
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.include.paths.549073773" name="Include paths (-I)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.include.paths" useByScannerDiscovery="true" valueType="includePath">
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.include.paths.549073773" name="Include paths (-I)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.include.paths" useByScannerDiscovery="true" valueType="includePath">
<listOptionValue builtIn="false" value="/usr/arm-none-eabi/include"/>
<listOptionValue builtIn="false" value="../Inc"/>
<listOptionValue builtIn="false" value="../Drivers/STM32L4xx_HAL_Driver/Inc"/>
@ -274,7 +274,7 @@
<listOptionValue builtIn="false" value="../Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc/"/>
<listOptionValue builtIn="false" value="../Middlewares/ST/STM32_USB_Device_Library/Core/Inc"/>
</option>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs.1057000273" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols">
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs.1057000273" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols">
<listOptionValue builtIn="false" value="__FPU_PRESENT=1"/>
<listOptionValue builtIn="false" value="USE_HAL_DRIVER"/>
<listOptionValue builtIn="false" value="ARM_MATH_CM4"/>
@ -284,10 +284,11 @@
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.warning.missingprototypes.706281784" name="Warn if a global function has no prototype (-Wmissing-prototypes)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.warning.missingprototypes" useByScannerDiscovery="true" value="true" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.warning.strictprototypes.981667488" name="Warn if a function has no arg type (-Wstrict-prototypes)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.warning.strictprototypes" useByScannerDiscovery="true" value="true" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.warning.badfunctioncast.1581623183" name="Warn if wrong cast (-Wbad-function-cast)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.warning.badfunctioncast" useByScannerDiscovery="true" value="true" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.std.1837039409" name="Language standard" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.std" useByScannerDiscovery="true" value="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.std.gnu11" valueType="enumerated"/>
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.1311038531" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input"/>
</tool>
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.1738445104" name="GNU ARM Cross C++ Compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler">
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.include.paths.1151610661" name="Include paths (-I)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.include.paths" useByScannerDiscovery="true" valueType="includePath">
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.include.paths.1151610661" name="Include paths (-I)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.include.paths" useByScannerDiscovery="true" valueType="includePath">
<listOptionValue builtIn="false" value="/usr/arm-none-eabi/include"/>
<listOptionValue builtIn="false" value="/usr/local/include"/>
<listOptionValue builtIn="false" value="../Inc"/>
@ -301,15 +302,15 @@
<listOptionValue builtIn="false" value="../Middlewares/ST/STM32_USB_Device_Library/Core/Inc"/>
<listOptionValue builtIn="false" value="../Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc/"/>
</option>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.defs.602101294" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols">
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.defs.602101294" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols">
<listOptionValue builtIn="false" value="__FPU_PRESENT=1"/>
<listOptionValue builtIn="false" value="USE_HAL_DRIVER"/>
<listOptionValue builtIn="false" value="ARM_MATH_CM4"/>
<listOptionValue builtIn="false" value="__weak=&quot;__attribute__((weak))&quot;"/>
<listOptionValue builtIn="false" value="STM32L433xx"/>
</option>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.std.1269136557" name="Language standard" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.std" useByScannerDiscovery="true" value="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.std.gnucpp1z" valueType="enumerated"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.abiversion.1480715728" name="ABI version" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.abiversion" useByScannerDiscovery="true" value="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.abiversion.9" valueType="enumerated"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.std.1269136557" name="Language standard" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.std" useByScannerDiscovery="true" value="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.std.gnucpp17" valueType="enumerated"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.abiversion.1480715728" name="ABI version" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.abiversion" useByScannerDiscovery="true" value="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.abiversion.13" valueType="enumerated"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.noexceptions.1677495363" name="Do not use exceptions (-fno-exceptions)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.noexceptions" useByScannerDiscovery="true" value="true" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.nortti.902756344" name="Do not use RTTI (-fno-rtti)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.nortti" useByScannerDiscovery="true" value="true" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.nousecxaatexit.1072054323" name="Do not use _cxa_atexit() (-fno-use-cxa-atexit)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.nousecxaatexit" useByScannerDiscovery="true" value="true" valueType="boolean"/>
@ -327,7 +328,7 @@
</tool>
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker.1881696985" name="GNU ARM Cross C++ Linker" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker">
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.gcsections.1261027452" name="Remove unused sections (-Xlinker --gc-sections)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.gcsections" useByScannerDiscovery="false" value="true" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.scriptfile.1929266642" name="Script files (-T)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.scriptfile" useByScannerDiscovery="false" valueType="stringList">
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.scriptfile.1929266642" name="Script files (-T)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.scriptfile" useByScannerDiscovery="false" valueType="stringList">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/STM32L433CCUx_FLASH.ld}&quot;"/>
</option>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.nostdlibs.118214268" name="No startup or default libs (-nostdlib)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.nostdlibs" useByScannerDiscovery="false" value="false" valueType="boolean"/>

Wyświetl plik

@ -3,7 +3,7 @@
<configuration id="ilg.gnuarmeclipse.managedbuild.cross.config.elf.debug.1309195742.6250637" name="ARM_Debug">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-875080106735501948" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT ARM Cross GCC Built-in Compiler Settings " parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-1331898519131319282" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT ARM Cross GCC Built-in Compiler Settings " parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
@ -14,7 +14,7 @@
<configuration id="ilg.gnuarmeclipse.managedbuild.cross.config.elf.debug.1309195742.6250637.815824991" name="ARM_Release">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-789413234192079628" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT ARM Cross GCC Built-in Compiler Settings " parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-1246228804734390092" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT ARM Cross GCC Built-in Compiler Settings " parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>

Wyświetl plik

@ -29,7 +29,7 @@ int powerOffViaUSB(void)
namespace mobilinkd { namespace tnc { namespace kiss {
const char FIRMWARE_VERSION[] = "2.0.1";
const char FIRMWARE_VERSION[] = "2.0.2";
const char HARDWARE_VERSION[] = "Mobilinkd TNC3 2.1.1";

Wyświetl plik

@ -1,11 +1,13 @@
// Copyright 2016 Rob Riggs <rob@mobilinkd.com>
// All rights reserved.
#ifndef NUCLEOTNC
#include "Log.h"
#include "bm78.h"
#endif
#include "SerialPort.hpp"
#include "PortInterface.h"
#include "HdlcFrame.hpp"
#include "bm78.h"
#include "Kiss.hpp"
#include "main.h"
@ -17,7 +19,14 @@
#include <cstring>
#include <atomic>
#ifdef NUCLEOTNC
extern UART_HandleTypeDef huart2;
UART_HandleTypeDef& huart_serial = huart2;
#else
extern UART_HandleTypeDef huart3;
UART_HandleTypeDef& huart_serial = huart3;
#endif
extern osMessageQId ioEventQueueHandle;
std::atomic<uint32_t> uart_error{HAL_UART_ERROR_NONE};
@ -35,6 +44,7 @@ typedef mobilinkd::tnc::memory::Pool<
3, RX_BUFFER_SIZE + 1> serial_pool_type;
serial_pool_type serialPool;
#ifndef NUCLEOTNC
void log_frame(mobilinkd::tnc::hdlc::IoFrame* frame)
{
int pos = 0;
@ -48,6 +58,7 @@ void log_frame(mobilinkd::tnc::hdlc::IoFrame* frame)
}
DEBUG((char*)tmpBuffer2);
}
#endif
// HAL does not have
HAL_StatusTypeDef UART_DMAPauseReceive(UART_HandleTypeDef *huart)
@ -115,12 +126,8 @@ void startSerialTask(void const* arg)
hdlc::IoFrame* frame = hdlc::acquire_wait();
HAL_UART_Receive_DMA(&huart3, rxBuffer, RX_BUFFER_SIZE * 2);
__HAL_UART_ENABLE_IT(&huart3, UART_IT_IDLE);
uint32_t last_sent_time = osKernelSysTick();
uint32_t current_sent_time = 0;
bool paused = false;
HAL_UART_Receive_DMA(&huart_serial, rxBuffer, RX_BUFFER_SIZE * 2);
__HAL_UART_ENABLE_IT(&huart_serial, UART_IT_IDLE);
while (true) {
osEvent evt = osMessageGet(serialPort->queue(), osWaitForever);
@ -133,11 +140,13 @@ void startSerialTask(void const* arg)
{
// Error received.
hdlc::release(frame);
#ifndef NUCLEOTNC
ERROR("UART Error: %08lx", uart_error.load());
#endif
uart_error.store(HAL_UART_ERROR_NONE);
frame = hdlc::acquire_wait();
HAL_UART_Receive_DMA(&huart3, rxBuffer, RX_BUFFER_SIZE * 2);
__HAL_UART_ENABLE_IT(&huart3, UART_IT_IDLE);
HAL_UART_Receive_DMA(&huart_serial, rxBuffer, RX_BUFFER_SIZE * 2);
__HAL_UART_ENABLE_IT(&huart_serial, UART_IT_IDLE);
continue;
}
@ -173,19 +182,17 @@ void startSerialTask(void const* arg)
reinterpret_cast<uint32_t>(frame),
osWaitForever) != osOK)
{
WARN("Failed to send serial frame");
hdlc::release(frame);
}
if (hdlc::ioFramePool().size() < (hdlc::ioFramePool().capacity() / 4))
{
UART_DMAPauseReceive(&huart3);
WARN("Pausing UART RX");
UART_DMAPauseReceive(&huart_serial);
while (hdlc::ioFramePool().size() < (hdlc::ioFramePool().capacity() / 2))
{
osThreadYield();
}
UART_DMAResumeReceive(&huart3);
UART_DMAResumeReceive(&huart_serial);
}
frame = hdlc::acquire_wait();
@ -320,7 +327,9 @@ void SerialPort::init()
osThreadDef(serialTask, startSerialTask, osPriorityAboveNormal, 0, 128);
serialTaskHandle_ = osThreadCreate(osThread(serialTask), this);
#ifndef NUCLEOTNC
DEBUG("serialTaskHandle_ = %p", serialTaskHandle_);
#endif
}
bool SerialPort::open()
@ -364,9 +373,9 @@ bool SerialPort::write(const uint8_t* data, uint32_t size, uint8_t type, uint32_
memcpy(TxBuffer, tmpBuffer, TX_BUFFER_SIZE);
txDoneFlag = false;
while (open_ and HAL_UART_Transmit_DMA(&huart3, TxBuffer, TX_BUFFER_SIZE) == HAL_BUSY)
while (open_ and HAL_UART_Transmit_DMA(&huart_serial, TxBuffer, TX_BUFFER_SIZE) == HAL_BUSY)
{
if (osKernelSysTick() > start + timeout) {
if (osKernelSysTick() - start > timeout) {
osMutexRelease(mutex_);
txDoneFlag = true;
return false;
@ -383,9 +392,9 @@ bool SerialPort::write(const uint8_t* data, uint32_t size, uint8_t type, uint32_
while (!txDoneFlag) osThreadYield();
memcpy(TxBuffer, tmpBuffer, pos);
txDoneFlag = false;
while (open_ and HAL_UART_Transmit_DMA(&huart3, TxBuffer, pos) == HAL_BUSY)
while (open_ and HAL_UART_Transmit_DMA(&huart_serial, TxBuffer, pos) == HAL_BUSY)
{
if (osKernelSysTick() > start + timeout) {
if (osKernelSysTick() - start > timeout) {
osMutexRelease(mutex_);
txDoneFlag = true;
return false;
@ -416,9 +425,9 @@ bool SerialPort::write(const uint8_t* data, uint32_t size, uint32_t timeout)
while (first != last) {
TxBuffer[pos++] = *first++;
if (pos == TX_BUFFER_SIZE) {
while (open_ and HAL_UART_Transmit(&huart3, TxBuffer, TX_BUFFER_SIZE, timeout) == HAL_BUSY)
while (open_ and HAL_UART_Transmit(&huart_serial, TxBuffer, TX_BUFFER_SIZE, timeout) == HAL_BUSY)
{
if (osKernelSysTick() > start + timeout) {
if (osKernelSysTick() - start > timeout) {
osMutexRelease(mutex_);
return false;
}
@ -429,18 +438,18 @@ bool SerialPort::write(const uint8_t* data, uint32_t size, uint32_t timeout)
}
}
while (open_ and HAL_UART_Transmit(&huart3, TxBuffer, TX_BUFFER_SIZE, timeout) == HAL_BUSY)
while (open_ and HAL_UART_Transmit(&huart_serial, TxBuffer, TX_BUFFER_SIZE, timeout) == HAL_BUSY)
{
if (osKernelSysTick() > start + timeout) {
if (osKernelSysTick() - start > timeout) {
osMutexRelease(mutex_);
return false;
}
osThreadYield();
}
while (open_ and HAL_UART_Transmit(&huart3, (uint8_t*)"\r\n", 2, timeout) == HAL_BUSY)
while (open_ and HAL_UART_Transmit(&huart_serial, (uint8_t*)"\r\n", 2, timeout) == HAL_BUSY)
{
if (osKernelSysTick() > start + timeout) {
if (osKernelSysTick() - start > timeout) {
osMutexRelease(mutex_);
return false;
}
@ -464,13 +473,15 @@ bool SerialPort::write(const uint8_t* data, uint32_t size, uint32_t timeout)
*/
bool SerialPort::abort_tx(hdlc::IoFrame* frame)
{
HAL_UART_AbortTransmit(&huart3);
HAL_UART_AbortTransmit(&huart_serial);
hdlc::release(frame);
#ifndef NUCLEOTNC
WARN("SerialPort::write timed out -- DMA aborted.");
HAL_GPIO_WritePin(BT_RESET_GPIO_Port, BT_RESET_Pin, GPIO_PIN_RESET);
osDelay(1);
HAL_GPIO_WritePin(BT_RESET_GPIO_Port, BT_RESET_Pin, GPIO_PIN_SET);
bm78_wait_until_ready();
#endif
txDoneFlag = true;
osMutexRelease(mutex_);
return false;
@ -478,10 +489,7 @@ bool SerialPort::abort_tx(hdlc::IoFrame* frame)
bool SerialPort::write(hdlc::IoFrame* frame, uint32_t timeout)
{
DEBUG("SerialPort::write sending frame");
if (!open_) {
WARN("SerialPort::write not open");
hdlc::release(frame);
return false;
}
@ -489,7 +497,6 @@ bool SerialPort::write(hdlc::IoFrame* frame, uint32_t timeout)
uint32_t start = osKernelSysTick();
if (osMutexWait(mutex_, timeout) != osOK) {
WARN("SerialPort::write timed out");
hdlc::release(frame);
return false;
}
@ -514,7 +521,7 @@ bool SerialPort::write(hdlc::IoFrame* frame, uint32_t timeout)
if (pos == TX_BUFFER_SIZE) {
while (!txDoneFlag) {
// txDoneFlag set in HAL_UART_TxCpltCallback() above when DMA completes.
if (osKernelSysTick() > (start + timeout)) {
if (osKernelSysTick() - start > timeout) {
return abort_tx(frame); // Abort DMA xfer on timeout.
} else {
osThreadYield();
@ -522,10 +529,10 @@ bool SerialPort::write(hdlc::IoFrame* frame, uint32_t timeout)
}
memcpy(TxBuffer, tmpBuffer, TX_BUFFER_SIZE);
txDoneFlag = false;
while (open_ and HAL_UART_Transmit_DMA(&huart3, TxBuffer, TX_BUFFER_SIZE) == HAL_BUSY)
while (open_ and HAL_UART_Transmit_DMA(&huart_serial, TxBuffer, TX_BUFFER_SIZE) == HAL_BUSY)
{
// This should not happen. HAL_BUSY should not occur when txDoneFlag set.
if (osKernelSysTick() > (start + timeout)) {
if (osKernelSysTick() - start > timeout) {
return abort_tx(frame); // Abort DMA xfer on timeout.
} else {
osThreadYield();
@ -540,7 +547,7 @@ bool SerialPort::write(hdlc::IoFrame* frame, uint32_t timeout)
while (!txDoneFlag) {
// txDoneFlag set in HAL_UART_TxCpltCallback() above when DMA completes.
if (osKernelSysTick() > (start + timeout)) {
if (osKernelSysTick() - start > timeout) {
return abort_tx(frame); // Abort DMA xfer on timeout.
} else {
osThreadYield();
@ -549,9 +556,9 @@ bool SerialPort::write(hdlc::IoFrame* frame, uint32_t timeout)
memcpy(TxBuffer, tmpBuffer, TX_BUFFER_SIZE);
txDoneFlag = false;
while (open_ and HAL_UART_Transmit_DMA(&huart3, TxBuffer, pos) == HAL_BUSY) {
while (open_ and HAL_UART_Transmit_DMA(&huart_serial, TxBuffer, pos) == HAL_BUSY) {
// This should not happen. HAL_BUSY should not occur when txDoneFlag set.
if (osKernelSysTick() > (start + timeout)) {
if (osKernelSysTick() - start > timeout) {
return abort_tx(frame); // Abort DMA xfer on timeout.
} else {
osThreadYield();

Wyświetl plik

@ -68,14 +68,14 @@ void UsbPort::add_char(uint8_t c)
frame_->source(hdlc::IoFrame::SERIAL_DATA);
osMessagePut(ioEventQueueHandle, reinterpret_cast<uint32_t>(frame_),
osWaitForever);
frame_ = hdlc::acquire();
frame_ = hdlc::acquire_wait();
state_ = WAIT_FBEGIN;
break;
default:
if (not frame_->push_back(c)) {
hdlc::release(frame_);
state_ = WAIT_FBEGIN; // Drop frame;
frame_ = hdlc::acquire();
frame_ = hdlc::acquire_wait();
}
}
break;
@ -86,20 +86,20 @@ void UsbPort::add_char(uint8_t c)
if (not frame_->push_back(FESC)) {
hdlc::release(frame_);
state_ = WAIT_FBEGIN; // Drop frame;
frame_ = hdlc::acquire();
frame_ = hdlc::acquire_wait();
}
break;
case TFEND:
if (not frame_->push_back(FEND)) {
hdlc::release(frame_);
state_ = WAIT_FBEGIN; // Drop frame;
frame_ = hdlc::acquire();
frame_ = hdlc::acquire_wait();
}
break;
default:
hdlc::release(frame_);
state_ = WAIT_FBEGIN; // Drop frame;
frame_ = hdlc::acquire();
frame_ = hdlc::acquire_wait();
}
break;
}
@ -107,7 +107,7 @@ void UsbPort::add_char(uint8_t c)
void UsbPort::run()
{
if (frame_ == nullptr) frame_ = hdlc::acquire();
if (frame_ == nullptr) frame_ = hdlc::acquire_wait();
while (true) {
osEvent evt = osMessageGet(queue(), osWaitForever);
@ -185,7 +185,7 @@ bool UsbPort::write(const uint8_t* data, uint32_t size, uint8_t type, uint32_t t
TxBuffer[pos++] = *slip_iter++;
if (pos == TX_BUFFER_SIZE) {
while (open_ and CDC_Transmit_FS(TxBuffer, pos) == USBD_BUSY) {
if (osKernelSysTick() > start + timeout) {
if (osKernelSysTick() - start > timeout) {
osMutexRelease(mutex_);
return false;
}
@ -197,8 +197,13 @@ bool UsbPort::write(const uint8_t* data, uint32_t size, uint8_t type, uint32_t t
// Buffer has room for at least one more byte.
TxBuffer[pos++] = 0xC0;
while (open_ and CDC_Transmit_FS(TxBuffer, pos) == USBD_BUSY)
while (open_ and CDC_Transmit_FS(TxBuffer, pos) == USBD_BUSY) {
if (osKernelSysTick() - start > timeout) {
osMutexRelease(mutex_);
return false;
}
osThreadYield();
}
osMutexRelease(mutex_);
@ -223,7 +228,7 @@ bool UsbPort::write(const uint8_t* data, uint32_t size, uint32_t timeout)
TxBuffer[pos++] = *first++;
if (pos == TX_BUFFER_SIZE) {
while (open_ and CDC_Transmit_FS(TxBuffer, pos) == USBD_BUSY) {
if (osKernelSysTick() > start + timeout) {
if (osKernelSysTick()- start > timeout) {
osMutexRelease(mutex_);
return false;
}
@ -234,14 +239,14 @@ bool UsbPort::write(const uint8_t* data, uint32_t size, uint32_t timeout)
}
while (open_ and CDC_Transmit_FS(TxBuffer, pos) == USBD_BUSY) {
if (osKernelSysTick() > start + timeout) {
if (osKernelSysTick() - start > timeout) {
osMutexRelease(mutex_);
return false;
}
osThreadYield();
}
while (open_ and CDC_Transmit_FS((uint8_t*)"\r\n", 2) == USBD_BUSY) {
if (osKernelSysTick() > start + timeout) {
if (osKernelSysTick() - start > timeout) {
osMutexRelease(mutex_);
return false;
}
@ -257,7 +262,7 @@ bool UsbPort::transmit_buffer(size_t pos, uint32_t start, uint32_t timeout)
{
while (open_ and CDC_Transmit_FS(TxBuffer, pos) == USBD_BUSY) {
if ((timeout != osWaitForever) and
(osKernelSysTick() > start + timeout))
(osKernelSysTick() - start > timeout))
{
if (USBD_LL_IsStallEP(
static_cast<USBD_HandleTypeDef*>(hUsbDeviceFS.pClassData),

Wyświetl plik

@ -37,7 +37,7 @@ You will be performing the following steps:
## Download the Software
The firmware update tool is available from here:
https://s3.amazonaws.com/mobilinkd/en.stm32cubeprog-1.4.0.zip
https://www.st.com/en/development-tools/stm32cubeprog.html
### Download the File