From 51027729cca6b00f554ab430be1b456163e57ff2 Mon Sep 17 00:00:00 2001 From: SPRESENSE <41312067+SPRESENSE@users.noreply.github.com> Date: Thu, 30 Jun 2022 10:56:19 +0900 Subject: [PATCH] examples/eltres_standalone: Import standalone sample Import standalone_mode_sample_app version 1.0.3. --- examples/eltres_standalone/CXM150x_Port.c | 421 ++++++++++ examples/eltres_standalone/CXM150x_Port.h | 57 ++ examples/eltres_standalone/CXM150x_typedef.h | 142 ++++ .../Sample_App_version_information.txt | 18 + .../main_standalone_mode_sample_app.c | 722 ++++++++++++++++++ .../main_standalone_mode_sample_app.h | 56 ++ .../standalone_mode_sample_app.ioc | 229 ++++++ .../standalone_mode_sample_app.patch | 68 ++ 8 files changed, 1713 insertions(+) create mode 100644 examples/eltres_standalone/CXM150x_Port.c create mode 100644 examples/eltres_standalone/CXM150x_Port.h create mode 100644 examples/eltres_standalone/CXM150x_typedef.h create mode 100644 examples/eltres_standalone/Sample_App_version_information.txt create mode 100644 examples/eltres_standalone/main_standalone_mode_sample_app.c create mode 100644 examples/eltres_standalone/main_standalone_mode_sample_app.h create mode 100644 examples/eltres_standalone/standalone_mode_sample_app.ioc create mode 100644 examples/eltres_standalone/standalone_mode_sample_app.patch diff --git a/examples/eltres_standalone/CXM150x_Port.c b/examples/eltres_standalone/CXM150x_Port.c new file mode 100644 index 000000000..6a1268ef6 --- /dev/null +++ b/examples/eltres_standalone/CXM150x_Port.c @@ -0,0 +1,421 @@ +// ========================================================================== +/*! +* @file CXM150x_Port.c +* @brief HAL wrapper functions +* @date 2021/08/16 +* +* Copyright 2021 Sony Semiconductor Solutions Corporation +* +* Redistribution and use in source and binary forms, with or without modification, +* are permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation and/or +* other materials provided with the distribution. +* +* 3. Neither the name of Sony Semiconductor Solutions Corporation nor the names of +* its contributors may be used to endorse or promote products derived from this +* software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +* IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +* OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +// ========================================================================= + +#include +#include +#include "stm32l0xx_hal.h" +#include "usart.h" +#include "CXM150x_Port.h" + +#define FOR_STM32_HAL_DRIVER + +extern void SystemClock_Config(void); + +static uint32_t g_rcv_cnt = 0; +static uint8_t *g_rcv_buf = NULL; +static uint8_t g_rcv_char = '\0'; + + +// =========================================================================== +//! Description to switch output destination of printf to PC +/*! + * + * @param [in] ch: Output data + * @param [out] none + * @par Global variable + * [in] huart2: UART2 handler + * [out] none + * + * @return output data +*/ +// =========================================================================== +#ifdef __GNUC__ +#define PUTCHAR_PROTOTYPE int32_t __io_putchar(int32_t ch) +#else +#define PUTCHAR_PROTOTYPE int32_t fputc(int32_t ch, FILE *f) +#endif +PUTCHAR_PROTOTYPE +{ +#ifdef FOR_STM32_HAL_DRIVER + HAL_UART_Transmit(&huart2, (uint8_t *)&ch, 1, 0xFFFF); +#endif + return ch; +} + +// =========================================================================== +//! UART communication buffer specification +/*! Call HAL's HAL_UART_Receive_IT function + * Specify the receive buffer for UART communication with CXM150x and enable the UART receive interrupt + * Buffer size must be prepared by the caller for 128 bytes + * + * @param [in] * rcv_char_buf: Pointer to receive buffer + * @param [out] none + * @par Global variable + * [in] huart1: UART handler + * [out] g_rcv_buf: Receive interrupt buffer + * + * @return interrupt setting result (OK, ERROR, BUSY, TIMEOUT) +*/ +// =========================================================================== +int32_t wrapper_CXM150x_set_uart_rx_buf(uint8_t *rcv_char_buf){ + + g_rcv_buf = rcv_char_buf; +#ifdef FOR_STM32_HAL_DRIVER + return HAL_UART_Receive_IT(&huart1, &g_rcv_char, 1); +#endif +} + +// =========================================================================== +//! CXM150x power control +/*! Set the power supply state by controlling the ENABLE pin with the HAL_GPIO_WritePin function of HAL + * + * @param [in] on_off: 1 for ON, 0 for OFF + * @param [out] none + * @par Global variable + * [in] none + * [out] D9 pin + * + * @return none +*/ +// =========================================================================== +void wrapper_CXM150x_set_power(CXM150x_power_state on_off){ + if(on_off == CXM150x_POWER_ON){ + // CXM150x power ON +#ifdef FOR_STM32_HAL_DRIVER + HAL_GPIO_WritePin(D9_GPO_RST_GPIO_Port, D9_GPO_RST_Pin, GPIO_PIN_SET); +#endif + } else { + // Power OFF operation +#ifdef FOR_STM32_HAL_DRIVER + HAL_GPIO_WritePin(D9_GPO_RST_GPIO_Port, D9_GPO_RST_Pin, GPIO_PIN_RESET); +#endif + } +} + +// =========================================================================== +//! CXM150x wake-up pin control +/*! Control WAKEUP pin with HAL_GPIO_WritePin function of HAL + * + * @param [in] on_off: 1 for ON, 0 for OFF + * @param [out] none + * @par Global variable + * [in] none + * [out] D12 pin + * + * @return none +*/ +// =========================================================================== +void wrapper_CXM150x_set_wakeup_pin(CXM150x_wakeup_state high_low){ + + if(high_low == CXM150x_WAKEUP_H){ +#ifdef FOR_STM32_HAL_DRIVER + HAL_GPIO_WritePin(D12_WAKEUP_GPIO_Port, D12_WAKEUP_Pin, GPIO_PIN_SET); +#endif + } else { +#ifdef FOR_STM32_HAL_DRIVER + HAL_GPIO_WritePin(D12_WAKEUP_GPIO_Port, D12_WAKEUP_Pin, GPIO_PIN_RESET); +#endif + } +} + +// =========================================================================== +//! Get CXM150x power supply status +/*! Call HAL_GPIO_ReadPin function of HAL to get ENABLE signal status + * + * @param [in] none + * @param [out] none + * @par Global variable + * [in] D9 pin + * [out] none + * + * @return signal On / Off status: 1 for ON, 0 for OFF + +*/ +// =========================================================================== +uint32_t wrapper_CXM150x_get_power(void){ +#ifdef FOR_STM32_HAL_DRIVER + GPIO_PinState pin_state = HAL_GPIO_ReadPin(D9_GPO_RST_GPIO_Port, D9_GPO_RST_Pin); + if(pin_state == GPIO_PIN_SET){ + return CXM150x_POWER_ON; + } else { + return CXM150x_POWER_OFF; + } +#endif +} + +// =========================================================================== +//! UART receive handler +/*! Buffers characters received by UART from CXM150x and continues UART reception until line feed code is received (timeout is fixed at 5 seconds) + * Call the uart_receive_to_buffer_callback function of the library core when a line feed code is received + * + * @param [in] none + * @param [out] none + * @par Global variable + * [in] huart1: UART handler + * [in] g_rcv_char: UART receive character + * [out] g_rcv_buf: Receive buffer + * [out] g_rcv_cnt: Number of characters received + * [out] g_uart_error_flg: UART error flag + * + * @return none +*/ +// =========================================================================== +void wrapper_CXM150x_uart_rx_callback(void){ + // Receive UART communication from CXM150x + uint32_t st_tick = wrapper_CXM150x_get_tick(); + while(1){ + if(g_rcv_cnt < RECEIVE_BUF_SIZE - 1){ // Subtract one because '\0' requires 1 byte + + if(g_rcv_char == '\n'){ // receive line feed code + // Set in receive buffer and inclement buffer counter + g_rcv_buf[g_rcv_cnt++] = g_rcv_char; + // Receive line feed code + g_rcv_buf[g_rcv_cnt++] = '\0'; + uart_receive_to_buffer_callback(WRAPPER_UART_RX_FROM_CXM150x,g_rcv_cnt); + g_rcv_cnt = 0; + g_rcv_buf[0] = '\0'; +#ifdef FOR_STM32_HAL_DRIVER + HAL_UART_Receive_IT(&huart1, &g_rcv_char, 1); +#endif + break; + } else { // Receive characters other than line feed code + // Set in receive buffer and inclement buffer counter + g_rcv_buf[g_rcv_cnt++] = g_rcv_char; + + // Make settings to receive the next character +#ifdef FOR_STM32_HAL_DRIVER + int32_t set_result = HAL_UART_Receive(&huart1,&g_rcv_char,1,MAX_TIME_OUT_TICK_COUNT); +#endif + // Setting error check + if(set_result != 0){ + if(g_rcv_cnt > 0){ + g_rcv_cnt--; + } + } + } + } else { + // Number of received bytes exceeded + g_rcv_cnt = 0; + g_rcv_buf[0] = '\0'; +#ifdef FOR_STM32_HAL_DRIVER + HAL_UART_Receive_IT(&huart1, &g_rcv_char, 1); +#endif + printf("UART_Receive g_rcv_cnt over\r\n"); + return; + } + + // timeout check + uint32_t c_time = wrapper_CXM150x_get_tick(); + if((c_time - st_tick) > MAX_UART_LINE_TIME_OUT_TICK_COUNT){ + printf("wrapper_CXM150x_uart_rx_callback time out.\r\n"); + // advance the counter because you can get one character + g_rcv_cnt++; + return; + } + } +} + +// =========================================================================== +//! UART transmission +/*! Call HAL_UART_Transmit function of HAL and send UART to CXM150x + * + * @param [in] * data: Pointer to transmission data buffer + * @param [in] len: Transmission data length + * @param [in] wait_count: Timeout time (unit is msec) + * @param [out] none + * @par Global variable + * [in] huart1: UART handler + * [out] none + * + * @return transmission result (OK, ERROR, BUSY, TIMEOUT) +*/ +// =========================================================================== +return_code wrapper_CXM150x_uart_transmit(uint8_t *data,uint16_t len,uint32_t wait_count){ +#ifdef FOR_STM32_HAL_DRIVER + int32_t ret; + char uartState; + uint32_t st_tick = wrapper_CXM150x_get_tick(); + + wrapper_CXM150x_set_wakeup_pin(CXM150x_WAKEUP_H); + + ret = HAL_UART_Transmit_IT(&huart1, data, len); + + if(ret == HAL_OK){ + while(1){ + uartState = HAL_UART_GetState(&huart1); + //b0 Tx state + // 0 : Ready (no Tx operation ongoing) + // 1 : Busy (Tx operation ongoing) + if((uartState & 0x01)==0x00){ + break; + } + + // timeout check + uint32_t c_time = wrapper_CXM150x_get_tick(); + if(c_time - st_tick > wait_count){ + printf("wrapper_CXM150x_uart_transmit time out.\r\n"); + wrapper_CXM150x_set_wakeup_pin(CXM150x_WAKEUP_L); + HAL_UART_AbortTransmit_IT(&huart1); + return RETURN_TIMEOUT; + } + } + }else{ + printf("Error: HAL_UART_Transmit %d\r\n",ret); + wrapper_CXM150x_set_wakeup_pin(CXM150x_WAKEUP_L); + HAL_UART_AbortTransmit_IT(&huart1); + return RETURN_NG; + } + + wrapper_CXM150x_set_wakeup_pin(CXM150x_WAKEUP_L); + + return RETURN_OK; +#endif +} + +// =========================================================================== +//! Get tick count +/*! Call HAL_GetTick function of HAL to get tick count + * Tick count is incremented every 1msec + * + * @param [in] none + * @param [out] none + * @par Global variable + * [in] none + * [out] none + * + * @return tick count value +*/ +// =========================================================================== +uint32_t wrapper_CXM150x_get_tick(void){ +#ifdef FOR_STM32_HAL_DRIVER + return HAL_GetTick(); +#endif +} + +// =========================================================================== +//! Wait processing +/*! Call HAL_Delay function of HAL and perform wait processing for specified msec + * + * @param [in] tick: Wait time (unit is msec) + * @param [out] none + * @par Global variable + * [in] none + * [out] none + * + * @return none +*/ +// =========================================================================== +void wrapper_CXM150x_delay(uint32_t tick){ +#ifdef FOR_STM32_HAL_DRIVER + HAL_Delay(tick); +#endif +} + +// =========================================================================== +//! Enter the microcomputer to the stop mode. +/*! Call HAL functions + * + * @param [in] none + * @param [out] none + * @par Global variable + * [in] none + * [out] none + * + * @return none +*/ +// =========================================================================== +void wrapper_enter_stop_mode(void){ +#ifdef FOR_STM32_HAL_DRIVER + HAL_SuspendTick(); + HAL_PWR_EnableSleepOnExit(); + HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI); +#endif +} + +// =========================================================================== +//! Enter the microcomputer to the normal mode. +/*! Call HAL functions + * + * @param [in] none + * @param [out] none + * @par Global variable + * [in] none + * [out] none + * + * @return none +*/ +// =========================================================================== +void wrapper_resume_stop_mode(void){ +#ifdef FOR_STM32_HAL_DRIVER + SystemClock_Config(); + HAL_ResumeTick(); + HAL_PWR_DisableSleepOnExit(); +#endif +} + +// =========================================================================== +//! INT_OUT2 handler +/*! Non-weak implementation of the same name function of startup_stm32l073xx.s, call the wrapper_int_out1 function of the application callback + * + * @param [in] none + * @param [out] none + * @par Global variable + * [in] none + * [out] none + * + * @return none +*/ +// =========================================================================== +void wrapper_CXM150x_int_out2(void){ + int2_callback(); +} + +// =========================================================================== +//! Reset the microcomputer. +/*! Call HAL functions + * + * @param [in] none + * @param [out] none + * @par Global variable + * [in] none + * [out] none + * + * @return none +*/ +// =========================================================================== +void wrapper_system_reset(void){ + NVIC_SystemReset(); +} diff --git a/examples/eltres_standalone/CXM150x_Port.h b/examples/eltres_standalone/CXM150x_Port.h new file mode 100644 index 000000000..29cd38035 --- /dev/null +++ b/examples/eltres_standalone/CXM150x_Port.h @@ -0,0 +1,57 @@ +// ========================================================================== +/*! +* @file CXM150x_Port.h +* @brief HAL wrapper functions +* @date 2021/08/16 +* +* Copyright 2021 Sony Semiconductor Solutions Corporation +* +* Redistribution and use in source and binary forms, with or without modification, +* are permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation and/or +* other materials provided with the distribution. +* +* 3. Neither the name of Sony Semiconductor Solutions Corporation nor the names of +* its contributors may be used to endorse or promote products derived from this +* software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +* IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +* OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +// ========================================================================= + +#ifndef __CXM150x_PORT_H +#define __CXM150x_PORT_H + +#include "CXM150x_typedef.h" +#include "main_standalone_mode_sample_app.h" + +#define WRAPPER_UART_RX_FROM_CXM150x (0) + +void wrapper_CXM150x_set_power(CXM150x_power_state on_off); +uint32_t wrapper_CXM150x_get_power(void); +void wrapper_CXM150x_set_wakeup_pin(CXM150x_wakeup_state high_low); +int32_t wrapper_CXM150x_set_uart_rx_buf(uint8_t *rcv_char_buf); +return_code wrapper_CXM150x_uart_transmit(uint8_t *data,uint16_t len,uint32_t wait_count); +uint32_t wrapper_CXM150x_get_tick(void); +void wrapper_CXM150x_delay(uint32_t tick); +void wrapper_enter_stop_mode(void); +void wrapper_resume_stop_mode(void); +void wrapper_CXM150x_int_out2(void); +void wrapper_system_reset(void); + +#endif // __CXM150x_PORT_H diff --git a/examples/eltres_standalone/CXM150x_typedef.h b/examples/eltres_standalone/CXM150x_typedef.h new file mode 100644 index 000000000..fef26127f --- /dev/null +++ b/examples/eltres_standalone/CXM150x_typedef.h @@ -0,0 +1,142 @@ +// ========================================================================== +/*! +* @file CXM150x_typedef.h +* @brief Define type of Application +* @date 2021/12/27 +* +* Copyright 2021 Sony Semiconductor Solutions Corporation +* +* Redistribution and use in source and binary forms, with or without modification, +* are permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation and/or +* other materials provided with the distribution. +* +* 3. Neither the name of Sony Semiconductor Solutions Corporation nor the names of +* its contributors may be used to endorse or promote products derived from this +* software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +* IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +* OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +// ========================================================================= +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __CXM150x_TYPEDEF +#define __CXM150x_TYPEDEF +/* Includes ------------------------------------------------------------------*/ +#include "stm32l0xx_hal.h" +/* Includes ------------------------------------------------------------------*/ + +// CXM150x power ON / OFF state constant +typedef enum { + CXM150x_POWER_OFF = 0, + CXM150x_POWER_ON +}CXM150x_power_state; + +// CXM150x WAKEUP High / Low state constant +typedef enum { + CXM150x_WAKEUP_L = 0, + CXM150x_WAKEUP_H +}CXM150x_wakeup_state; + +// Define the command response +typedef enum { + RETURN_NG = 0, + RETURN_OK, + RETURN_TIMEOUT, + RETURN_BUSY +} return_code; + +// OK or NG in the command response message from CXM150x +typedef enum { + CXM150x_RESPONSE_NG = 0, + CXM150x_RESPONSE_OK +}CXM150x_response_ok_ng; + +// Flag ON / OFF definition +typedef enum { + FLAG_OFF = 0, + FLAG_ON +}FlagOnOff; + +typedef enum { + HOST_NORMAL_MODE = 0, + HOST_STOP_MODE, +}HOST_Mode; + +typedef enum { + CXM150x_EVENT_NONE = 0, + CXM150x_EVENT_SYS_RESET_POWER_PIN, + CXM150x_EVENT_TX_PLD, + CXM150x_EVENT_SYS_TO_DSLP, + CXM150x_EVENT_SYS_RESET_DSLP, + CXM150x_EVENT_POC_EN, + CXM150x_EVENT_GNSS_TIMER_TOUT, + CXM150x_EVENT_SYS_RESET_CMD, + CXM150x_EVENT_TX_DUTY, + CXM150x_EVENT_UNKNOWN_EVENT +}CXM150x_Event; + +// Maximum message length from CXM150x +#define RECEIVE_BUF_SIZE (0x80) + +// Communication wait time with CXM (unit is msec) +#define MAX_TIME_OUT_TICK_COUNT (5000) + +// Timeout period from receiving the first character of UART communication to receiving CR + LF +#define MAX_UART_LINE_TIME_OUT_TICK_COUNT (3000) + +// Timeout period for CXM150x power ON message wait +#define MAX_POWER_ON_TIME_OUT_TICK_COUNT (10000) + +// Mode setting timeout time +#define MAX_SET_MODE_TIME_OUT_TICK_COUNT (10000) + +/* Command string definition */ +#define CXM150x_COMMAND_PREFIX_CHAR '<' +#define CXM150x_RESPONSE_PREFIX_CHAR '>' +#define CXM150x_EVENT_PREFIX_CHAR '|' + + +#define CXM150x_PAYLOAD_SET_COMMAND "TX PLD SET" +#define CXM150x_PAYLOAD_SET_RESPONSE "> TX PLD SET" +#define CXM150x_PAYLOAD_EVENT_MESSAGE "| TX PLD" +#define CXM150x_POWER_ON_EVENT_MESSAGE "| SYS RESET POR_PIN" +#define CXM150x_TX_POC_EVENT_MESSAGE "| TX POC_EN" +#define CXM150x_SYS_TO_DSLP_EVENT_MESSAGE "| SYS TO_DSLP" +#define CXM150x_POWER_DSLP_EVENT_MESSAGE "| SYS RESET DSLP" +#define CXM150x_SYS_MODE_SET_COMMAND "SYS MODE SET" +#define CXM150x_SYS_MODE_SET_RESPONSE "> SYS MODE SET" +#define CXM150x_TX_POC_EN_SET_COMMAND "TX POC_EN SET" +#define CXM150x_POC_EN_ON "ON" +#define CXM150x_TX_POC_EN_SET_RESPONSE "> TX POC_EN SET" +#define CXM150x_TX_DUTY_SET_EVT_COMMAND "TX DUTY SET_EVT" +#define CXM150x_TX_DUTY_SET_EVT_ON "ON" +#define CXM150x_TX_DUTY_SET_EVT_RESPONSE "> TX DUTY SET_EVT" +#define CXM150x_TX_DUTY_EVENT_MESSAGE "| TX DUTY" + +#define CXM150x_NORMAL_MODE (0) +#define CXM150x_GNSS_TIMER_TOUT_EVENT_MESSAGE "| GNSS TIMER TOUT" +#define CXM150x_SYS_RESET_CMD_EVENT_MESSAGE "| SYS RESET CMD" + +// Payload length (16 bytes) +#define CXM150x_PAYLOAD_LEN (16) + +#endif /* __CXM150x_TYPEDEF */ + + + + diff --git a/examples/eltres_standalone/Sample_App_version_information.txt b/examples/eltres_standalone/Sample_App_version_information.txt new file mode 100644 index 000000000..814f05b22 --- /dev/null +++ b/examples/eltres_standalone/Sample_App_version_information.txt @@ -0,0 +1,18 @@ +================================================================================ + + CXM150x main_standalone_mode_sample_app code version information + +================================================================================ +2021/12/24 version 1.0.3 + Add EU Duty function + Change files + main_standalone_mode_sample_app.c +2021/08/20 version 1.0.2 + Addition of license terms + add TX POC_EN SET command + Change files + main_standalone_mode_sample_app.c,main_standalone_mode_sample_app.h,CXM150x_Port.c,CXM150x_Port.h,CXM150x_typedef.h +2021/03/23 version 1.0.1 + add SYS MODE SET command +2021/01/26 version 1.0.0 + Preliminary(first release version) diff --git a/examples/eltres_standalone/main_standalone_mode_sample_app.c b/examples/eltres_standalone/main_standalone_mode_sample_app.c new file mode 100644 index 000000000..6d810e9f8 --- /dev/null +++ b/examples/eltres_standalone/main_standalone_mode_sample_app.c @@ -0,0 +1,722 @@ +// ========================================================================== +/*! +* @file main_standalone_mode_sample_app.c +* @brief Stand alone mode application +* @date 2021/12/27 +* +* Copyright 2021 Sony Semiconductor Solutions Corporation +* +* Redistribution and use in source and binary forms, with or without modification, +* are permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation and/or +* other materials provided with the distribution. +* +* 3. Neither the name of Sony Semiconductor Solutions Corporation nor the names of +* its contributors may be used to endorse or promote products derived from this +* software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +* IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +* OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +// ========================================================================= + +#include "main_standalone_mode_sample_app.h" + +// Sample application name definition +#define SAMPLE_APP_NAME "main_standalone_mode_sample_app" +// Sample application version definition +#define SAMPLE_APP_VER "1.0.3" + +// Buffer for UART RX (used in the receive interrupt) +uint8_t g_rcv_buf[RECEIVE_BUF_SIZE] = ""; + +// Buffer for event message from CXM150x +uint8_t g_event_buf[RECEIVE_BUF_SIZE] = ""; + +// Buffer for response message from CXM150x +uint8_t g_response_buf[RECEIVE_BUF_SIZE] = ""; + +// Buffer for LPWA payload data +uint8_t g_payload_buf[CXM150x_PAYLOAD_LEN] = ""; + +// Flag whether the host microcontroller is staying in STOP mode or not. +HOST_Mode g_host_mode = HOST_NORMAL_MODE; + +// Flag ON when INT_OUT2 interrupt occurs, OFF when UART is received +FlagOnOff g_INT_OUT2_flag = FLAG_OFF; + +// Additional payload value set position definition +#define ADDITIONAL_PAYLOAD_VAL_START_BIT (117) +#define ADDITIONAL_PAYLOAD_VAL_BIT_LEN (11) + +// Set to a value other than 0 to enable PoC format send(unencrypted message) +#define TX_POC_USE (0) + +// Set to a value other than 0 to enable TX Duty event +#define TX_DUTY_USE (0) + +return_code send_TX_PLD_SET_command(void); +uint32_t get_additional_val(void); +void set_additional_payload_data(uint32_t additional_val); + +// =========================================================================== +//! Callback function of UART receive interrupt occurs +/*! + * + * @param [in] type_from: UART Sender(fixed value) + * @param [in] rcv_cnt: UART RX length + * @param [out] none + * @par Global variable + * [in] g_rcv_buf: UART RX message + * [out] g_event_buf: event buffer + * [out] g_response_buf: response buffer + * [out] g_INT_OUT2_flag: INT_OUT2 flag + * @return none +*/ +// =========================================================================== +void uart_receive_to_buffer_callback(uint32_t type_from,uint32_t rcv_cnt){ + g_INT_OUT2_flag = FLAG_OFF; + + // Check the first byte to determine if it is an event or a response. + if(g_rcv_buf[0] == CXM150x_EVENT_PREFIX_CHAR){ + // receive event message + strncpy((char*)g_event_buf,(char*)g_rcv_buf,rcv_cnt); + g_event_buf[rcv_cnt] = '\0'; + } else if(g_rcv_buf[0] == CXM150x_RESPONSE_PREFIX_CHAR){ + // Receive command response + strncpy((char*)g_response_buf,(char*)g_rcv_buf,rcv_cnt); + g_response_buf[rcv_cnt] = '\0'; + } else { + printf("rcv message error:%s",g_rcv_buf); + } +} + +// =========================================================================== +//! Callback function of INT_OUT2 interrupt occurs +/*! + * + * @param [in] none + * @param [out] none + * @par Global variable + * [in] none + * [out] g_INT_OUT2_flag : INT_OUT2 flag + * [out] g_host_mode : host stop flag + * @return none +*/ +// =========================================================================== +void int2_callback(void){ + if(g_host_mode == HOST_STOP_MODE){ + wrapper_resume_stop_mode(); + g_host_mode = HOST_NORMAL_MODE; + printf("host resume:int2_callback\r\n"); + } + g_INT_OUT2_flag = FLAG_ON; + printf("int2_callback\r\n"); +} + +// =========================================================================== +//! Functions for setting payload data +/*! + * + * @param[in] st_bit : Specifies the number of bits to be set in the payload + * @param[in] bit_len : Bit length to be specified + * @param[in] dt : Data to be set + * @param[out] payload : The destination payload data buffer + * @par Global variable + * [in] none + * [out] none + * + * @return none +*/ +// =========================================================================== +void set_payload_bits(uint32_t st_bit,uint32_t bit_len,uint32_t dt,uint8_t *payload){ + uint32_t payload_offset_bytes = st_bit / 8; + uint32_t payload_offset_bits = st_bit % 8; + uint32_t dt_offset_bit = bit_len - 1; + + for(uint32_t i=0;i 0 ? 1 : 0; + uint8_t *tgt_payload_byte = payload + payload_offset_bytes; + + uint8_t shift = (7 - payload_offset_bits); + + uint8_t msk = 0x01 << shift; + msk = ~msk; + *tgt_payload_byte &= msk; + *tgt_payload_byte |= (dt_bit << shift); + + dt_offset_bit--; + if(payload_offset_bits < 7){ + payload_offset_bits++; + } else { + payload_offset_bits = 0; + payload_offset_bytes++; + } + } +} + +// =========================================================================== +//! Get last word from message +/*! ex. from " response_wait_tick_count){ + printf("response timeout\r\n"); + ret = RETURN_TIMEOUT; + break; + } + + } + + return ret; +} + +// =========================================================================== +//! send "TX PLD SET" command and wait response +/*! + * + * @param [in] none + * @param [out] none + * @par Global variable + * [in] none + * [out] none + * + * @return none +*/ +// =========================================================================== +return_code send_TX_PLD_SET_command(){ + return_code ret = RETURN_NG; + uint8_t command_buf[RECEIVE_BUF_SIZE] = ""; + + // creating a command transmission string + snprintf((char*)command_buf,RECEIVE_BUF_SIZE,"%c %s ",CXM150x_COMMAND_PREFIX_CHAR,CXM150x_PAYLOAD_SET_COMMAND); + // byte array to ASCII conversion + for(uint32_t i=0;i MAX_POWER_ON_TIME_OUT_TICK_COUNT){ + printf("power on timeout\r\n"); + break; + } + } +#if TX_POC_USE + send_TX_POC_EN_SET_command(); + if(check_event() != CXM150x_EVENT_SYS_RESET_CMD){ + send_SYS_MODE_SET_command(); + } +#else + send_SYS_MODE_SET_command(); +#endif + +#if TX_DUTY_USE + send_TX_DUTY_SET_EVT_command(); +#endif + + // Infinite loop + while(1){ + // enter stop mode if unporosessed messages are not exist + if(check_unprosessed_messages() == FLAG_OFF){ + printf("enter stop mode\r\n"); + g_host_mode = HOST_STOP_MODE; + wrapper_enter_stop_mode(); + printf("resume stop mode\r\n"); + } + + if(g_event_buf[0] != '\0'){ + // process event message + CXM150x_Event ret = check_event(); + if(ret == CXM150x_EVENT_TX_PLD){ + parse_payload_event_data(); + g_event_buf[0] = '\0'; + uint32_t additional_val = get_additional_val(); + set_additional_payload_data(additional_val); + send_TX_PLD_SET_command(); + } else if(ret == CXM150x_EVENT_SYS_TO_DSLP){ + g_event_buf[0] = '\0'; + printf("SYS TO DSLP event\r\n"); + wrapper_CXM150x_set_wakeup_pin(CXM150x_WAKEUP_H); + } else if(ret == CXM150x_EVENT_SYS_RESET_DSLP){ + g_event_buf[0] = '\0'; + printf("SYS RESET DSLP event\r\n"); +#if TX_POC_USE + send_TX_POC_EN_SET_command(); + if(check_event() != CXM150x_EVENT_SYS_RESET_CMD){ + send_SYS_MODE_SET_command(); + } +#else + send_SYS_MODE_SET_command(); +#endif +#if TX_DUTY_USE + send_TX_DUTY_SET_EVT_command(); +#endif + } else if(ret == CXM150x_EVENT_POC_EN){ +#if TX_POC_USE + g_event_buf[0] = '\0'; + printf("TX PoC enable message\r\n"); +#else + printf("FATAL error :An unencrypted message\r\n"); + wrapper_system_reset(); +#endif + } else if(ret == CXM150x_EVENT_GNSS_TIMER_TOUT){ + g_event_buf[0] = '\0'; + printf("GNSS TIMER TOUT event\r\n"); + } else if(ret == CXM150x_EVENT_SYS_RESET_CMD){ + g_event_buf[0] = '\0'; + printf("SYS RESET CMD event\r\n"); +#if TX_POC_USE + send_TX_POC_EN_SET_command(); + if(check_event() != CXM150x_EVENT_SYS_RESET_CMD){ + send_SYS_MODE_SET_command(); + } +#else + send_SYS_MODE_SET_command(); +#endif +#if TX_DUTY_USE + send_TX_DUTY_SET_EVT_command(); +#endif + } else if(ret == CXM150x_EVENT_TX_DUTY){ + g_event_buf[0] = '\0'; + printf("TX DUTY event\r\n"); + } else { + printf("ERROR:%s",g_event_buf); + g_event_buf[0] = '\0'; + } + + } else if(g_response_buf[0] != '\0'){ + printf("rcv:%s",g_response_buf); + g_response_buf[0] = '\0'; + } + } +} + diff --git a/examples/eltres_standalone/main_standalone_mode_sample_app.h b/examples/eltres_standalone/main_standalone_mode_sample_app.h new file mode 100644 index 000000000..1829c33ce --- /dev/null +++ b/examples/eltres_standalone/main_standalone_mode_sample_app.h @@ -0,0 +1,56 @@ +// ========================================================================== +/*! +* @file main_standalone_mode_sample_app.h +* @brief header file of main_standalone_mode_sample_app.c +* @date 2021/08/16 +* +* Copyright 2021 Sony Semiconductor Solutions Corporation +* +* Redistribution and use in source and binary forms, with or without modification, +* are permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation and/or +* other materials provided with the distribution. +* +* 3. Neither the name of Sony Semiconductor Solutions Corporation nor the names of +* its contributors may be used to endorse or promote products derived from this +* software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +* IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +* OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +// ========================================================================= +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __MAIN_STANDALONE_MODE_SAMPLE_APP_H +#define __MAIN_STANDALONE_MODE_SAMPLE_APP_H +/* Includes ------------------------------------------------------------------*/ +#include +#include +#include "stm32l0xx_hal.h" +#include "CXM150x_typedef.h" +#include "CXM150x_Port.h" +/* Includes ------------------------------------------------------------------*/ +int main_standalone_mode_sample_app(void); +void uart_receive_to_buffer_callback(uint32_t type_from,uint32_t rcv_cnt); +void int2_callback(void); + +/* Private define ------------------------------------------------------------*/ + +#endif /* __MAIN_STANDALONE_MODE_SAMPLE_APP_H */ + + + + diff --git a/examples/eltres_standalone/standalone_mode_sample_app.ioc b/examples/eltres_standalone/standalone_mode_sample_app.ioc new file mode 100644 index 000000000..152a2066a --- /dev/null +++ b/examples/eltres_standalone/standalone_mode_sample_app.ioc @@ -0,0 +1,229 @@ +#MicroXplorer Configuration settings - do not modify +File.Version=6 +KeepUserPlacement=false +Mcu.Family=STM32L0 +Mcu.IP0=NVIC +Mcu.IP1=RCC +Mcu.IP2=SYS +Mcu.IP3=USART1 +Mcu.IP4=USART2 +Mcu.IPNb=5 +Mcu.Name=STM32L073R(B-Z)Tx +Mcu.Package=LQFP64 +Mcu.Pin0=PC14-OSC32_IN +Mcu.Pin1=PC15-OSC32_OUT +Mcu.Pin10=PA5 +Mcu.Pin11=PA6 +Mcu.Pin12=PA7 +Mcu.Pin13=PB0 +Mcu.Pin14=PB10 +Mcu.Pin15=PC7 +Mcu.Pin16=PA9 +Mcu.Pin17=PA10 +Mcu.Pin18=PA13 +Mcu.Pin19=PA14 +Mcu.Pin2=PH0-OSC_IN +Mcu.Pin20=PB3 +Mcu.Pin21=PB4 +Mcu.Pin22=PB5 +Mcu.Pin23=PB6 +Mcu.Pin24=PB8 +Mcu.Pin25=PB9 +Mcu.Pin26=VP_SYS_VS_Systick +Mcu.Pin3=PC0 +Mcu.Pin4=PC1 +Mcu.Pin5=PA0 +Mcu.Pin6=PA1 +Mcu.Pin7=PA2 +Mcu.Pin8=PA3 +Mcu.Pin9=PA4 +Mcu.PinsNb=27 +Mcu.ThirdPartyNb=0 +Mcu.UserConstants= +Mcu.UserName=STM32L073RZTx +MxCube.Version=6.0.1 +MxDb.Version=DB.6.0.0 +NVIC.EXTI4_15_IRQn=true\:2\:0\:true\:false\:true\:true\:true +NVIC.ForceEnableDMAVector=true +NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:true\:false +NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:true\:false +NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:true\:false +NVIC.SVC_IRQn=true\:0\:0\:false\:false\:true\:true\:false +NVIC.SysTick_IRQn=true\:0\:0\:false\:false\:true\:true\:true +NVIC.USART1_IRQn=true\:1\:0\:true\:false\:true\:true\:true +PA0.GPIOParameters=GPIO_Label +PA0.GPIO_Label=A0_HIZ_NOT_USED +PA0.Locked=true +PA0.Signal=GPIO_Input +PA1.GPIOParameters=GPIO_Label +PA1.GPIO_Label=A1_HIZ_NOT_USED +PA1.Locked=true +PA1.Signal=GPIO_Input +PA10.Locked=true +PA10.Mode=Asynchronous +PA10.Signal=USART1_RX +PA13.Mode=Serial_Wire +PA13.Signal=SYS_SWDIO +PA14.Mode=Serial_Wire +PA14.Signal=SYS_SWCLK +PA2.Mode=Asynchronous +PA2.Signal=USART2_TX +PA3.Mode=Asynchronous +PA3.Signal=USART2_RX +PA4.GPIOParameters=GPIO_Label +PA4.GPIO_Label=A2_HIZ_NOT_USED +PA4.Locked=true +PA4.Signal=GPIO_Input +PA5.GPIOParameters=GPIO_Label +PA5.GPIO_Label=D13_HIZ_NOT_USED +PA5.Locked=true +PA5.Signal=GPIO_Input +PA6.GPIOParameters=GPIO_Label +PA6.GPIO_Label=D12_WAKEUP +PA6.Locked=true +PA6.Signal=GPIO_Output +PA7.GPIOParameters=GPIO_Label +PA7.GPIO_Label=D11_HIZ_NOT_USED +PA7.Locked=true +PA7.Signal=GPIO_Input +PA9.Locked=true +PA9.Mode=Asynchronous +PA9.Signal=USART1_TX +PB0.GPIOParameters=GPIO_Label +PB0.GPIO_Label=A3_HIZ_NOT_USED +PB0.Locked=true +PB0.Signal=GPIO_Input +PB10.GPIOParameters=GPIO_PuPd,GPIO_Label +PB10.GPIO_Label=D6_GPI_WKUP +PB10.GPIO_PuPd=GPIO_PULLDOWN +PB10.Locked=true +PB10.Signal=GPXTI10 +PB3.Locked=true +PB3.Mode=CTS_RTS +PB3.Signal=USART1_RTS +PB4.Locked=true +PB4.Mode=CTS_RTS +PB4.Signal=USART1_CTS +PB5.GPIOParameters=GPIO_Label +PB5.GPIO_Label=D4_HIZ_NOT_USED +PB5.Locked=true +PB5.Signal=GPIO_Input +PB6.GPIOParameters=GPIO_Label +PB6.GPIO_Label=D10_HIZ_NOT_USED +PB6.Locked=true +PB6.Signal=GPIO_Input +PB8.GPIOParameters=GPIO_Label +PB8.GPIO_Label=D15_HIZ_NOT_USED +PB8.Locked=true +PB8.Signal=GPIO_Input +PB9.GPIOParameters=GPIO_Label +PB9.GPIO_Label=D14_HIZ_NOT_USED +PB9.Locked=true +PB9.Signal=GPIO_Input +PC0.GPIOParameters=GPIO_PuPd,GPIO_ModeDefaultEXTI +PC0.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_RISING +PC0.GPIO_PuPd=GPIO_PULLDOWN +PC0.Locked=true +PC0.Signal=GPXTI0 +PC1.GPIOParameters=GPIO_Label +PC1.GPIO_Label=A4_HIZ_NOT_USED +PC1.Locked=true +PC1.Signal=GPIO_Input +PC14-OSC32_IN.Mode=LSE-External-Oscillator +PC14-OSC32_IN.Signal=RCC_OSC32_IN +PC15-OSC32_OUT.Mode=LSE-External-Oscillator +PC15-OSC32_OUT.Signal=RCC_OSC32_OUT +PC7.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label +PC7.GPIO_Label=D9_GPO_RST +PC7.GPIO_PuPd=GPIO_NOPULL +PC7.GPIO_Speed=GPIO_SPEED_FREQ_LOW +PC7.Locked=true +PC7.Signal=GPIO_Output +PH0-OSC_IN.Mode=HSE-External-Clock-Source +PH0-OSC_IN.Signal=RCC_OSC_IN +PinOutPanel.RotationAngle=0 +ProjectManager.AskForMigrate=true +ProjectManager.BackupPrevious=false +ProjectManager.CompilerOptimize=2 +ProjectManager.ComputerToolchain=false +ProjectManager.CoupleFile=true +ProjectManager.CustomerFirmwarePackage= +ProjectManager.DefaultFWLocation=true +ProjectManager.DeletePrevious=false +ProjectManager.DeviceId=STM32L073RZTx +ProjectManager.FirmwarePackage=STM32Cube FW_L0 V1.11.3 +ProjectManager.FreePins=false +ProjectManager.HalAssertFull=true +ProjectManager.HeapSize=0x200 +ProjectManager.KeepUserCode=true +ProjectManager.LastFirmware=true +ProjectManager.LibraryCopy=0 +ProjectManager.MainLocation=Src +ProjectManager.NoMain=false +ProjectManager.PreviousToolchain= +ProjectManager.ProjectBuild=false +ProjectManager.ProjectFileName=standalone_mode_sample_app.ioc +ProjectManager.ProjectName=standalone_mode_sample_app +ProjectManager.RegisterCallBack= +ProjectManager.StackSize=0xC00 +ProjectManager.TargetToolchain=MDK-ARM V5 +ProjectManager.ToolChainLocation= +ProjectManager.UnderRoot=false +ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-true,3-MX_USART1_UART_Init-USART1-false-HAL-true,4-MX_USART2_UART_Init-USART2-false-HAL-true +RCC.48CLKFreq_Value=32000000 +RCC.48RNGFreq_Value=32000000 +RCC.48USBFreq_Value=32000000 +RCC.AHBFreq_Value=32000000 +RCC.APB1Freq_Value=32000000 +RCC.APB1TimFreq_Value=32000000 +RCC.APB2Freq_Value=32000000 +RCC.APB2TimFreq_Value=32000000 +RCC.EnbaleCSS=false +RCC.FCLKCortexFreq_Value=32000000 +RCC.FamilyName=M +RCC.HCLKFreq_Value=32000000 +RCC.HSE_VALUE=8000000 +RCC.HSI16_VALUE=16000000 +RCC.HSI48_VALUE=48000000 +RCC.HSI_VALUE=16000000 +RCC.I2C1Freq_Value=32000000 +RCC.I2C3Freq_Value=32000000 +RCC.IPParameters=48CLKFreq_Value,48RNGFreq_Value,48USBFreq_Value,AHBFreq_Value,APB1Freq_Value,APB1TimFreq_Value,APB2Freq_Value,APB2TimFreq_Value,EnbaleCSS,FCLKCortexFreq_Value,FamilyName,HCLKFreq_Value,HSE_VALUE,HSI16_VALUE,HSI48_VALUE,HSI_VALUE,I2C1Freq_Value,I2C3Freq_Value,LCDFreq_Value,LPTIMFreq_Value,LPUARTFreq_Value,LSI_VALUE,MCOPinFreq_Value,MSI_VALUE,PLLCLKFreq_Value,PLLMUL,PLLSourceVirtual,PWRFreq_Value,RTCClockSelection,RTCClockSelectionVirtual,RTCFreq_Value,RTCHSEDivFreq_Value,SYSCLKFreq_VALUE,SYSCLKSource,TIMFreq_Value,TimerFreq_Value,USART1Freq_Value,USART2Freq_Value,VCOInputFreq_Value,VCOOutputFreq_Value,WatchDogFreq_Value +RCC.LCDFreq_Value=32768 +RCC.LPTIMFreq_Value=32000000 +RCC.LPUARTFreq_Value=32000000 +RCC.LSI_VALUE=37000 +RCC.MCOPinFreq_Value=32000000 +RCC.MSI_VALUE=2097000 +RCC.PLLCLKFreq_Value=32000000 +RCC.PLLMUL=RCC_PLLMUL_8 +RCC.PLLSourceVirtual=RCC_PLLSOURCE_HSE +RCC.PWRFreq_Value=32000000 +RCC.RTCClockSelection=RCC_RTCCLKSOURCE_LSE +RCC.RTCClockSelectionVirtual=RCC_RTCCLKSOURCE_LSE +RCC.RTCFreq_Value=32768 +RCC.RTCHSEDivFreq_Value=4000000 +RCC.SYSCLKFreq_VALUE=32000000 +RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK +RCC.TIMFreq_Value=32000000 +RCC.TimerFreq_Value=32000000 +RCC.USART1Freq_Value=32000000 +RCC.USART2Freq_Value=32000000 +RCC.VCOInputFreq_Value=8000000 +RCC.VCOOutputFreq_Value=64000000 +RCC.WatchDogFreq_Value=37000 +SH.GPXTI0.0=GPIO_EXTI0 +SH.GPXTI0.ConfNb=1 +SH.GPXTI10.0=GPIO_EXTI10 +SH.GPXTI10.ConfNb=1 +USART1.BaudRate=115200 +USART1.IPParameters=BaudRate,WordLength,VirtualMode-Asynchronous +USART1.VirtualMode-Asynchronous=VM_ASYNC +USART1.WordLength=WORDLENGTH_8B +USART2.BaudRate=115200 +USART2.IPParameters=VirtualMode-Asynchronous,BaudRate,WordLength +USART2.VirtualMode-Asynchronous=VM_ASYNC +USART2.WordLength=WORDLENGTH_8B +VP_SYS_VS_Systick.Mode=SysTick +VP_SYS_VS_Systick.Signal=SYS_VS_Systick +board=single_profile_sample_app diff --git a/examples/eltres_standalone/standalone_mode_sample_app.patch b/examples/eltres_standalone/standalone_mode_sample_app.patch new file mode 100644 index 000000000..a1bdb4fac --- /dev/null +++ b/examples/eltres_standalone/standalone_mode_sample_app.patch @@ -0,0 +1,68 @@ +diff -upr Src/main.c Src/main.c +--- Src/main.c 2021-04-20 14:50:08.129003300 +0900 ++++ Src/main.c 2021-04-20 11:09:32.000000000 +0900 +@@ -24,7 +24,7 @@ + + /* Private includes ----------------------------------------------------------*/ + /* USER CODE BEGIN Includes */ +- ++#include "main_standalone_mode_sample_app.h" + /* USER CODE END Includes */ + + /* Private typedef -----------------------------------------------------------*/ +@@ -89,7 +89,7 @@ int main(void) + MX_USART1_UART_Init(); + MX_USART2_UART_Init(); + /* USER CODE BEGIN 2 */ +- ++ main_standalone_mode_sample_app(); + /* USER CODE END 2 */ + + /* Infinite loop */ +diff -upr Src/stm32l0xx_it.c Src/stm32l0xx_it.c +--- Src/stm32l0xx_it.c 2021-04-20 14:50:07.686468100 +0900 ++++ Src/stm32l0xx_it.c 2021-04-20 11:09:32.000000000 +0900 +@@ -23,6 +23,7 @@ + #include "stm32l0xx_it.h" + /* Private includes ----------------------------------------------------------*/ + /* USER CODE BEGIN Includes */ ++#include "CXM150x_Port.h" + /* USER CODE END Includes */ + + /* Private typedef -----------------------------------------------------------*/ +@@ -145,7 +146,9 @@ void SysTick_Handler(void) + void EXTI4_15_IRQHandler(void) + { + /* USER CODE BEGIN EXTI4_15_IRQn 0 */ +- ++ if(__HAL_GPIO_EXTI_GET_IT(GPIO_PIN_10) != RESET){ ++ wrapper_CXM150x_int_out2(); ++ } + /* USER CODE END EXTI4_15_IRQn 0 */ + HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_10); + /* USER CODE BEGIN EXTI4_15_IRQn 1 */ +diff -upr Src/usart.c Src/usart.c +--- Src/usart.c 2021-04-20 14:50:07.545171800 +0900 ++++ Src/usart.c 2021-04-20 11:09:32.000000000 +0900 +@@ -21,7 +21,7 @@ + #include "usart.h" + + /* USER CODE BEGIN 0 */ +- ++extern void wrapper_CXM150x_uart_rx_callback(void); + /* USER CODE END 0 */ + + UART_HandleTypeDef huart1; +@@ -185,7 +185,11 @@ void HAL_UART_MspDeInit(UART_HandleTypeD + } + + /* USER CODE BEGIN 1 */ +- ++void HAL_UART_RxCpltCallback(UART_HandleTypeDef *UartHandle){ ++ if(UartHandle->Instance==USART1){ ++ wrapper_CXM150x_uart_rx_callback(); ++ } ++} + /* USER CODE END 1 */ + + /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/