Compare commits
8 Commits
main
...
feature/ml
| Author | SHA1 | Date | |
|---|---|---|---|
| 93870fb725 | |||
| 207b91460d | |||
| 6094e7b0e7 | |||
| b02f4af38d | |||
| 8e3b1526aa | |||
| 8c209ac6aa | |||
| 9925b7a686 | |||
| 68193b096c |
@@ -23,7 +23,7 @@
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.fpu.116246094" name="Floating-point unit" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.fpu" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.fpu.value.fpv5-d16" valueType="enumerated"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi.1041462468" name="Floating-point ABI" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi.value.hard" valueType="enumerated"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board.1294249446" name="Board" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board" value="genericBoard" valueType="string"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults.19322524" name="Defaults" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults" value="com.st.stm32cube.ide.common.services.build.inputs.revA.1.0.6 || Debug || true || Executable || com.st.stm32cube.ide.mcu.gnu.managedbuild.option.toolchain.value.workspace || STM32H723VGTx || 0 || 0 || arm-none-eabi- || ${gnu_tools_for_stm32_compiler_path} || ../Core/Inc | ../FATFS/Target | ../FATFS/App | ../USB_DEVICE/App | ../USB_DEVICE/Target | ../Drivers/STM32H7xx_HAL_Driver/Inc | ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy | ../Middlewares/Third_Party/FreeRTOS/Source/include | ../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 | ../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F | ../Middlewares/Third_Party/FatFs/src | ../Middlewares/ST/STM32_USB_Device_Library/Core/Inc | ../Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc | ../Drivers/CMSIS/Device/ST/STM32H7xx/Include | ../Drivers/CMSIS/Include || || || USE_FULL_LL_DRIVER | USE_HAL_DRIVER | STM32H723xx || || EEPROM | Drivers | Core/Startup | Middlewares | Core | FATFS | USB_DEVICE || || || ${workspace_loc:/${ProjName}/STM32H723VGTX_FLASH.ld} || true || NonSecure || || secure_nsclib.o || || None || || || " valueType="string"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults.19322524" name="Defaults" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults" value="com.st.stm32cube.ide.common.services.build.inputs.revA.1.0.6 || Debug || true || Executable || com.st.stm32cube.ide.mcu.gnu.managedbuild.option.toolchain.value.workspace || STM32H723VGTx || 0 || 0 || arm-none-eabi- || ${gnu_tools_for_stm32_compiler_path} || ../Core/Inc | ../FATFS/Target | ../FATFS/App | ../USB_DEVICE/App | ../USB_DEVICE/Target | ../Drivers/STM32H7xx_HAL_Driver/Inc | ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy | ../Middlewares/Third_Party/FreeRTOS/Source/include | ../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 | ../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F | ../Middlewares/Third_Party/FatFs/src | ../Middlewares/ST/STM32_USB_Device_Library/Core/Inc | ../Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc | ../Drivers/CMSIS/Device/ST/STM32H7xx/Include | ../Drivers/CMSIS/Include || || || USE_FULL_LL_DRIVER | USE_HAL_DRIVER | STM32H723xx || || Drivers | Core/Startup | Middlewares | Core | FATFS | USB_DEVICE || || || ${workspace_loc:/${ProjName}/STM32H723VGTX_FLASH.ld} || true || NonSecure || || secure_nsclib.o || || None || || || " valueType="string"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.debug.option.cpuclock.784195808" superClass="com.st.stm32cube.ide.mcu.debug.option.cpuclock" value="275" valueType="string"/>
|
||||
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform.550567667" isAbstract="false" osList="all" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform"/>
|
||||
<builder buildPath="${workspace_loc:/CLS_Master}/Debug" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder.1667139540" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder"/>
|
||||
@@ -85,7 +85,6 @@
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="EEPROM"/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Core"/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="FATFS"/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Middlewares"/>
|
||||
@@ -118,7 +117,7 @@
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.fpu.315263605" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.fpu" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.fpu.value.fpv5-d16" valueType="enumerated"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi.861723814" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi.value.hard" valueType="enumerated"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board.575901382" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board" value="genericBoard" valueType="string"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults.41596049" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults" value="com.st.stm32cube.ide.common.services.build.inputs.revA.1.0.6 || Release || false || Executable || com.st.stm32cube.ide.mcu.gnu.managedbuild.option.toolchain.value.workspace || STM32H723VGTx || 0 || 0 || arm-none-eabi- || ${gnu_tools_for_stm32_compiler_path} || ../Core/Inc | ../FATFS/Target | ../FATFS/App | ../USB_DEVICE/App | ../USB_DEVICE/Target | ../Drivers/STM32H7xx_HAL_Driver/Inc | ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy | ../Middlewares/Third_Party/FreeRTOS/Source/include | ../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 | ../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F | ../Middlewares/Third_Party/FatFs/src | ../Middlewares/ST/STM32_USB_Device_Library/Core/Inc | ../Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc | ../Drivers/CMSIS/Device/ST/STM32H7xx/Include | ../Drivers/CMSIS/Include || || || USE_FULL_LL_DRIVER | USE_HAL_DRIVER | STM32H723xx || || EEPROM | Drivers | Core/Startup | Middlewares | Core | FATFS | USB_DEVICE || || || ${workspace_loc:/${ProjName}/STM32H723VGTX_FLASH.ld} || true || NonSecure || || secure_nsclib.o || || None || || || " valueType="string"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults.41596049" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults" value="com.st.stm32cube.ide.common.services.build.inputs.revA.1.0.6 || Release || false || Executable || com.st.stm32cube.ide.mcu.gnu.managedbuild.option.toolchain.value.workspace || STM32H723VGTx || 0 || 0 || arm-none-eabi- || ${gnu_tools_for_stm32_compiler_path} || ../Core/Inc | ../FATFS/Target | ../FATFS/App | ../USB_DEVICE/App | ../USB_DEVICE/Target | ../Drivers/STM32H7xx_HAL_Driver/Inc | ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy | ../Middlewares/Third_Party/FreeRTOS/Source/include | ../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 | ../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F | ../Middlewares/Third_Party/FatFs/src | ../Middlewares/ST/STM32_USB_Device_Library/Core/Inc | ../Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc | ../Drivers/CMSIS/Device/ST/STM32H7xx/Include | ../Drivers/CMSIS/Include || || || USE_FULL_LL_DRIVER | USE_HAL_DRIVER | STM32H723xx || || Drivers | Core/Startup | Middlewares | Core | FATFS | USB_DEVICE || || || ${workspace_loc:/${ProjName}/STM32H723VGTX_FLASH.ld} || true || NonSecure || || secure_nsclib.o || || None || || || " valueType="string"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.debug.option.cpuclock.669660917" superClass="com.st.stm32cube.ide.mcu.debug.option.cpuclock" value="275" valueType="string"/>
|
||||
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform.62262984" isAbstract="false" osList="all" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform"/>
|
||||
<builder buildPath="${workspace_loc:/CLS_Master}/Release" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder.1586300933" managedBuildOn="true" name="Gnu Make Builder.Release" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder"/>
|
||||
@@ -176,7 +175,6 @@
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="EEPROM"/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Core"/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="FATFS"/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Middlewares"/>
|
||||
|
||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -25,3 +25,6 @@
|
||||
[submodule "Application/MLZR_Comm"]
|
||||
path = Application/MLZR_Comm
|
||||
url = git@git.lan:ODDIY/MLZR_Comm.git
|
||||
[submodule "Application/MLZR_GLASM"]
|
||||
path = Application/MLZR_GLASM
|
||||
url = git@git.lan:ODDIY/MLZR_GLASM.git
|
||||
|
||||
100
.mxproject
100
.mxproject
File diff suppressed because one or more lines are too long
@@ -1,7 +1,10 @@
|
||||
include_directories(MLZR_Comm_Conf)
|
||||
|
||||
add_subdirectory(Tasks)
|
||||
add_subdirectory(CLS)
|
||||
add_subdirectory(CLS_BSP)
|
||||
add_subdirectory(BSP)
|
||||
add_subdirectory(ram_loader)
|
||||
add_subdirectory(MLZR_GLASM)
|
||||
add_subdirectory(MLZR_Comm)
|
||||
add_subdirectory(Vehicle)
|
||||
Submodule Application/MLZR_Comm updated: 48a98f4c82...baa031e9c3
14
Application/MLZR_Comm_Conf/mlzr_driver_conf.h
Normal file
14
Application/MLZR_Comm_Conf/mlzr_driver_conf.h
Normal file
@@ -0,0 +1,14 @@
|
||||
// Define macros for UART and DMA configurations
|
||||
#define MAIN_UART USART1
|
||||
#define MAIN_DMA_RX 1
|
||||
#define MAIN_DMA_RX_CHANNEL 0
|
||||
#define MAIN_DMA_TX 1
|
||||
#define MAIN_DMA_TX_CHANNEL 1
|
||||
|
||||
#define HALF_UART USART3
|
||||
#define HALF_DMA_RX 1
|
||||
#define HALF_DMA_RX_CHANNEL 2
|
||||
#define HALF_DMA_TX 1
|
||||
#define HALF_DMA_TX_CHANNEL 3
|
||||
|
||||
#define DMA_MEM_ATTR __attribute__((section(".data")))
|
||||
1
Application/MLZR_GLASM
Submodule
1
Application/MLZR_GLASM
Submodule
Submodule Application/MLZR_GLASM added at 613d6c69f8
@@ -13,6 +13,7 @@ target_sources(${PROJECT_NAME}
|
||||
${CMAKE_CURRENT_LIST_DIR}/LightTask.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/LightState.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/Headlight_can.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/DisplayComm.c
|
||||
|
||||
INTERFACE
|
||||
${CMAKE_CURRENT_LIST_DIR}/UsbDataHandler.h
|
||||
@@ -24,4 +25,4 @@ target_sources(${PROJECT_NAME}
|
||||
|
||||
target_include_directories(${PROJECT_NAME} INTERFACE ${CMAKE_CURRENT_LIST_DIR})
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC PROTOS CLS)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE Revision CLS_BSP BSP ulog Vehicle ram_loader)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE Revision CLS_BSP BSP ulog Vehicle ram_loader mlzr_comm TinyFrame)
|
||||
@@ -318,10 +318,9 @@ extern uint8_t gCLS_DEVICE_ADDRESS;
|
||||
void DataClbk_cls_device_RequestList(void* msg, uint32_t length) {
|
||||
memset(&list,0,sizeof(list));
|
||||
// add yourself
|
||||
|
||||
CLS_Position_t position = CLS_BSP_GetPosition();
|
||||
CLS_Type_t type = CLS_BSP_GetDeviceType();
|
||||
|
||||
|
||||
list.devices[list.devices_count].available = true;
|
||||
list.devices[list.devices_count].canid = GENERATE_CLS_ADDRESS(CLS_CODE_STATUS, gCLS_DEVICE_ADDRESS, CLS_CH_STA_HEATBEAT);
|
||||
list.devices[list.devices_count].device = gCLS_DEVICE_ADDRESS;
|
||||
@@ -333,7 +332,21 @@ void DataClbk_cls_device_RequestList(void* msg, uint32_t length) {
|
||||
list.devices[list.devices_count].fw_version[1] = VERSION_INFO.patch;
|
||||
list.devices[list.devices_count].fw_version[2] = VERSION_INFO.minor;
|
||||
list.devices[list.devices_count].fw_version[3] = VERSION_INFO.major;
|
||||
|
||||
list.devices_count++;
|
||||
|
||||
//add display
|
||||
list.devices[list.devices_count].available = true;
|
||||
list.devices[list.devices_count].canid = GENERATE_CLS_ADDRESS(CLS_CODE_STATUS, gCLS_DEVICE_ADDRESS+1, CLS_CH_STA_HEATBEAT);
|
||||
list.devices[list.devices_count].device = gCLS_DEVICE_ADDRESS+1;
|
||||
list.devices[list.devices_count].type = cls_device_Type_DISPLAY; // enum to uint
|
||||
list.devices[list.devices_count].position[0] = position.p0;
|
||||
list.devices[list.devices_count].position[1] = position.p1;
|
||||
list.devices[list.devices_count].position_count = 2;
|
||||
list.devices[list.devices_count].fw_version[0] = 0;
|
||||
list.devices[list.devices_count].fw_version[1] = 0;
|
||||
list.devices[list.devices_count].fw_version[2] = 0;
|
||||
list.devices[list.devices_count].fw_version[3] = 0;
|
||||
|
||||
list.devices_count++;
|
||||
|
||||
for (size_t i = 0; i < 16; i++)
|
||||
|
||||
16
Application/Tasks/DisplayComm.c
Normal file
16
Application/Tasks/DisplayComm.c
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
#include "main.h"
|
||||
#include "UsbDataHandler.h"
|
||||
#include "stdint.h"
|
||||
#include "mlzr_comm.h"
|
||||
#include "pb_decode.h"
|
||||
#include "display.pb.h"
|
||||
|
||||
static cls_display_SetLayout msg_cls_display_SetLayout;
|
||||
|
||||
|
||||
void DataClbk_cls_display_SetLayout(void* msg, uint32_t length) {
|
||||
DATA_CLBK_SETUP(cls_display_SetLayout);
|
||||
uint8_t num = (uint8_t)msg_cls_display_SetLayout.layout;
|
||||
TF_SendSimple(tf_fallback,0x0F, &num, sizeof(num));
|
||||
}
|
||||
@@ -156,8 +156,13 @@ void DataClbk_cls_firmware_Done(void *msg, uint32_t length) {
|
||||
|
||||
if(msg_cls_firmware_Done.device_id == gCLS_DEVICE_ADDRESS) {
|
||||
RamLoader_LoadApplication();
|
||||
} else {
|
||||
} else if (msg_cls_firmware_Done.device_id == gCLS_DEVICE_ADDRESS +1) {
|
||||
// send fw to display
|
||||
// todo !
|
||||
|
||||
} {
|
||||
|
||||
// send fw to slave
|
||||
FirmwareUpdateArgs args;
|
||||
args.device = msg_cls_firmware_Done.device_id;
|
||||
memcpy(args.name, msg_cls_firmware_Start.name, sizeof(args.name));
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <pb_decode.h>
|
||||
#include "cls_device.pb.h"
|
||||
#include "usb.pb.h"
|
||||
#include "display.pb.h"
|
||||
#include "stdbool.h"
|
||||
|
||||
/* Declare the thread function */
|
||||
@@ -67,6 +68,7 @@ union {
|
||||
cls_headlight_SaveSettings msg_cls_headlight_SaveSettings;
|
||||
cls_headlight_RequestSettings msg_cls_headlight_RequestSettings;
|
||||
cls_headlight_RequestBrightness msg_cls_headlight_RequestBrightness;
|
||||
cls_display_SetLayout msg_cls_display_SetLayout;
|
||||
} mem_msg_decode;
|
||||
|
||||
|
||||
@@ -129,6 +131,7 @@ message_handler_t message_handlers[] = {
|
||||
MESSAGE_HANDLER(cls_usb_PackageType_HEADLIGHT_SAVE_SETTINGS, cls_headlight_SaveSettings),
|
||||
MESSAGE_HANDLER(cls_usb_PackageType_HEADLIGHT_REQUEST_SETTINGS, cls_headlight_RequestSettings),
|
||||
MESSAGE_HANDLER(cls_usb_PackageType_HEADLIGHT_REQUEST_BRIGHTNESS, cls_headlight_RequestBrightness),
|
||||
MESSAGE_HANDLER(cls_usb_PackageType_DISPLAY_SET_LAYOUT, cls_display_SetLayout),
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -140,6 +140,7 @@ void DataClbk_cls_headlight_Settings(void* msg, uint32_t length);
|
||||
void DataClbk_cls_headlight_SaveSettings(void* msg, uint32_t length);
|
||||
void DataClbk_cls_headlight_RequestSettings(void* msg, uint32_t length);
|
||||
void DataClbk_cls_headlight_RequestBrightness(void* msg, uint32_t length);
|
||||
void DataClbk_cls_display_SetLayout(void* msg, uint32_t length);
|
||||
|
||||
#include "usb.pb.h"
|
||||
void USBDataResonse(void * msg, const pb_msgdesc_t *fields, cls_usb_PackageType typeid);
|
||||
|
||||
@@ -26,6 +26,43 @@ ADC1.SamplingTime-2\#ChannelRegularConversion=ADC_SAMPLETIME_32CYCLES_5
|
||||
ADC1.SamplingTime-3\#ChannelRegularConversion=ADC_SAMPLETIME_32CYCLES_5
|
||||
ADC1.SamplingTime-4\#ChannelRegularConversion=ADC_SAMPLETIME_32CYCLES_5
|
||||
ADC1.master=1
|
||||
Bdma.LPUART1_RX.0.Direction=DMA_PERIPH_TO_MEMORY
|
||||
Bdma.LPUART1_RX.0.EventEnable=DISABLE
|
||||
Bdma.LPUART1_RX.0.Instance=BDMA_Channel0
|
||||
Bdma.LPUART1_RX.0.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||
Bdma.LPUART1_RX.0.MemInc=DMA_MINC_ENABLE
|
||||
Bdma.LPUART1_RX.0.Mode=DMA_NORMAL
|
||||
Bdma.LPUART1_RX.0.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||
Bdma.LPUART1_RX.0.PeriphInc=DMA_PINC_DISABLE
|
||||
Bdma.LPUART1_RX.0.Polarity=HAL_DMAMUX_REQ_GEN_RISING
|
||||
Bdma.LPUART1_RX.0.Priority=DMA_PRIORITY_LOW
|
||||
Bdma.LPUART1_RX.0.RequestNumber=1
|
||||
Bdma.LPUART1_RX.0.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,SignalID,Polarity,RequestNumber,SyncSignalID,SyncPolarity,SyncEnable,EventEnable,SyncRequestNumber
|
||||
Bdma.LPUART1_RX.0.SignalID=NONE
|
||||
Bdma.LPUART1_RX.0.SyncEnable=DISABLE
|
||||
Bdma.LPUART1_RX.0.SyncPolarity=HAL_DMAMUX_SYNC_NO_EVENT
|
||||
Bdma.LPUART1_RX.0.SyncRequestNumber=1
|
||||
Bdma.LPUART1_RX.0.SyncSignalID=NONE
|
||||
Bdma.LPUART1_TX.1.Direction=DMA_MEMORY_TO_PERIPH
|
||||
Bdma.LPUART1_TX.1.EventEnable=DISABLE
|
||||
Bdma.LPUART1_TX.1.Instance=BDMA_Channel1
|
||||
Bdma.LPUART1_TX.1.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||
Bdma.LPUART1_TX.1.MemInc=DMA_MINC_ENABLE
|
||||
Bdma.LPUART1_TX.1.Mode=DMA_NORMAL
|
||||
Bdma.LPUART1_TX.1.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||
Bdma.LPUART1_TX.1.PeriphInc=DMA_PINC_DISABLE
|
||||
Bdma.LPUART1_TX.1.Polarity=HAL_DMAMUX_REQ_GEN_RISING
|
||||
Bdma.LPUART1_TX.1.Priority=DMA_PRIORITY_LOW
|
||||
Bdma.LPUART1_TX.1.RequestNumber=1
|
||||
Bdma.LPUART1_TX.1.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,SignalID,Polarity,RequestNumber,SyncSignalID,SyncPolarity,SyncEnable,EventEnable,SyncRequestNumber
|
||||
Bdma.LPUART1_TX.1.SignalID=NONE
|
||||
Bdma.LPUART1_TX.1.SyncEnable=DISABLE
|
||||
Bdma.LPUART1_TX.1.SyncPolarity=HAL_DMAMUX_SYNC_NO_EVENT
|
||||
Bdma.LPUART1_TX.1.SyncRequestNumber=1
|
||||
Bdma.LPUART1_TX.1.SyncSignalID=NONE
|
||||
Bdma.Request0=LPUART1_RX
|
||||
Bdma.Request1=LPUART1_TX
|
||||
Bdma.RequestsNb=2
|
||||
CAD.formats=
|
||||
CAD.pinconfig=
|
||||
CAD.provider=
|
||||
@@ -198,36 +235,38 @@ I2C2.Timing=0x00D0D8FF
|
||||
KeepUserPlacement=false
|
||||
LPTIM4.ClockPrescaler=LPTIM_PRESCALER_DIV64
|
||||
LPTIM4.IPParameters=ClockPrescaler
|
||||
LPUART1.BaudRate=2000000
|
||||
LPUART1.IPParameters=BaudRate
|
||||
LPUART1.BaudRate=1000000
|
||||
LPUART1.FIFOMode=UART_FIFOMODE_DISABLE
|
||||
LPUART1.IPParameters=BaudRate,FIFOMode
|
||||
Mcu.CPN=STM32H723VGT6
|
||||
Mcu.Family=STM32H7
|
||||
Mcu.IP0=ADC1
|
||||
Mcu.IP1=CORTEX_M7
|
||||
Mcu.IP10=I2C2
|
||||
Mcu.IP11=LPTIM4
|
||||
Mcu.IP12=LPUART1
|
||||
Mcu.IP13=NVIC
|
||||
Mcu.IP14=PWR
|
||||
Mcu.IP15=RCC
|
||||
Mcu.IP16=RNG
|
||||
Mcu.IP17=RTC
|
||||
Mcu.IP18=SDMMC1
|
||||
Mcu.IP19=SYS
|
||||
Mcu.IP2=CRC
|
||||
Mcu.IP20=TIM2
|
||||
Mcu.IP21=USART1
|
||||
Mcu.IP22=USART3
|
||||
Mcu.IP23=USB_DEVICE
|
||||
Mcu.IP24=USB_OTG_HS
|
||||
Mcu.IP3=DEBUG
|
||||
Mcu.IP4=DMA
|
||||
Mcu.IP5=FATFS
|
||||
Mcu.IP6=FDCAN1
|
||||
Mcu.IP7=FDCAN2
|
||||
Mcu.IP8=FREERTOS
|
||||
Mcu.IP9=I2C1
|
||||
Mcu.IPNb=25
|
||||
Mcu.IP1=BDMA
|
||||
Mcu.IP10=I2C1
|
||||
Mcu.IP11=I2C2
|
||||
Mcu.IP12=LPTIM4
|
||||
Mcu.IP13=LPUART1
|
||||
Mcu.IP14=NVIC
|
||||
Mcu.IP15=PWR
|
||||
Mcu.IP16=RCC
|
||||
Mcu.IP17=RNG
|
||||
Mcu.IP18=RTC
|
||||
Mcu.IP19=SDMMC1
|
||||
Mcu.IP2=CORTEX_M7
|
||||
Mcu.IP20=SYS
|
||||
Mcu.IP21=TIM2
|
||||
Mcu.IP22=USART1
|
||||
Mcu.IP23=USART3
|
||||
Mcu.IP24=USB_DEVICE
|
||||
Mcu.IP25=USB_OTG_HS
|
||||
Mcu.IP3=CRC
|
||||
Mcu.IP4=DEBUG
|
||||
Mcu.IP5=DMA
|
||||
Mcu.IP6=FATFS
|
||||
Mcu.IP7=FDCAN1
|
||||
Mcu.IP8=FDCAN2
|
||||
Mcu.IP9=FREERTOS
|
||||
Mcu.IPNb=26
|
||||
Mcu.Name=STM32H723VGTx
|
||||
Mcu.Package=LQFP100
|
||||
Mcu.Pin0=PE2
|
||||
@@ -302,6 +341,8 @@ Mcu.UserName=STM32H723VGTx
|
||||
MxCube.Version=6.9.2
|
||||
MxDb.Version=DB.6.0.92
|
||||
NVIC.ADC_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
|
||||
NVIC.BDMA_Channel0_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true
|
||||
NVIC.BDMA_Channel1_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true
|
||||
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false
|
||||
NVIC.DMA1_Stream0_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true
|
||||
NVIC.DMA1_Stream1_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true
|
||||
@@ -317,6 +358,7 @@ NVIC.FDCAN2_IT1_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
|
||||
NVIC.ForceEnableDMAVector=true
|
||||
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false
|
||||
NVIC.LPTIM4_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
|
||||
NVIC.LPUART1_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
|
||||
NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false
|
||||
NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false
|
||||
NVIC.OTG_HS_EP1_IN_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true
|
||||
@@ -540,7 +582,7 @@ ProjectManager.ToolChainLocation=
|
||||
ProjectManager.UAScriptAfterPath=
|
||||
ProjectManager.UAScriptBeforePath=
|
||||
ProjectManager.UnderRoot=true
|
||||
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_DMA_Init-DMA-false-HAL-true,4-MX_I2C2_Init-I2C2-false-HAL-true,5-MX_LPUART1_UART_Init-LPUART1-false-HAL-true,6-MX_USART1_UART_Init-USART1-false-LL-true,7-MX_USART3_UART_Init-USART3-false-LL-true,8-MX_RTC_Init-RTC-false-HAL-true,9-MX_SDMMC1_SD_Init-SDMMC1-false-HAL-true,10-MX_FATFS_Init-FATFS-false-HAL-false,11-MX_ADC1_Init-ADC1-false-HAL-true,12-MX_FDCAN1_Init-FDCAN1-false-HAL-true,13-MX_USB_DEVICE_Init-USB_DEVICE-false-HAL-false,14-MX_FDCAN2_Init-FDCAN2-false-HAL-true,15-MX_I2C1_Init-I2C1-false-HAL-true,16-MX_CRC_Init-CRC-false-HAL-true,17-MX_RNG_Init-RNG-false-HAL-true,18-MX_TIM2_Init-TIM2-false-HAL-true,19-MX_LPTIM4_Init-LPTIM4-false-HAL-true,0-MX_CORTEX_M7_Init-CORTEX_M7-false-HAL-true,0-MX_VREFBUF_Init-VREFBUF-false-HAL-true,0-MX_PWR_Init-PWR-false-HAL-true
|
||||
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_DMA_Init-DMA-false-HAL-true,4-MX_BDMA_Init-BDMA-false-HAL-true,5-MX_I2C2_Init-I2C2-false-HAL-true,6-MX_LPUART1_UART_Init-LPUART1-false-HAL-true,7-MX_USART1_UART_Init-USART1-false-LL-true,8-MX_USART3_UART_Init-USART3-false-LL-true,9-MX_RTC_Init-RTC-false-HAL-true,10-MX_SDMMC1_SD_Init-SDMMC1-false-HAL-true,11-MX_FATFS_Init-FATFS-false-HAL-false,12-MX_ADC1_Init-ADC1-false-HAL-true,13-MX_FDCAN1_Init-FDCAN1-false-HAL-true,14-MX_USB_DEVICE_Init-USB_DEVICE-false-HAL-false,15-MX_FDCAN2_Init-FDCAN2-false-HAL-true,16-MX_I2C1_Init-I2C1-false-HAL-true,17-MX_CRC_Init-CRC-false-HAL-true,18-MX_RNG_Init-RNG-false-HAL-true,19-MX_LPTIM4_Init-LPTIM4-false-HAL-true,20-MX_TIM2_Init-TIM2-false-HAL-true,0-MX_CORTEX_M7_Init-CORTEX_M7-false-HAL-true,0-MX_PWR_Init-PWR-false-HAL-true
|
||||
RCC.ADCFreq_Value=96000000
|
||||
RCC.AHB12Freq_Value=275000000
|
||||
RCC.AHB4Freq_Value=275000000
|
||||
|
||||
@@ -125,6 +125,7 @@ nanopb_generate_cpp(PROTO_SRCS PROTO_HDRS RELPATH proto
|
||||
proto/light.proto
|
||||
proto/usb.proto
|
||||
proto/headlight.proto
|
||||
proto/display.proto
|
||||
)
|
||||
add_library(PROTOS ${PROTO_SRCS} ${PROTO_HDRS})
|
||||
target_include_directories(PROTOS PUBLIC ${NANOPB_INCLUDE_DIRS} ${PROJECT_BINARY_DIR})
|
||||
@@ -143,7 +144,7 @@ target_sources(${CMAKE_PROJECT_NAME} PUBLIC ${sources_SRCS})
|
||||
|
||||
target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC Tasks CLS CLS_BSP BSP EE24 INA219 ulog ram_loader Vehicle)
|
||||
#target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC PROTOS)
|
||||
target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC mlzr_comm TinyFrame uart_driver)
|
||||
target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC mlzr_comm TinyFrame uart_driver mlzr_glasm)
|
||||
#target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC lwrb)
|
||||
|
||||
target_compile_options(${CMAKE_PROJECT_NAME} PRIVATE
|
||||
|
||||
52
Core/Inc/bdma.h
Normal file
52
Core/Inc/bdma.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file bdma.h
|
||||
* @brief This file contains all the function prototypes for
|
||||
* the bdma.c file
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2024 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __BDMA_H__
|
||||
#define __BDMA_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "main.h"
|
||||
|
||||
/* DMA memory to memory transfer handles -------------------------------------*/
|
||||
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* USER CODE BEGIN Private defines */
|
||||
|
||||
/* USER CODE END Private defines */
|
||||
|
||||
void MX_BDMA_Init(void);
|
||||
|
||||
/* USER CODE BEGIN Prototypes */
|
||||
|
||||
/* USER CODE END Prototypes */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __BDMA_H__ */
|
||||
|
||||
@@ -72,7 +72,10 @@ void SDMMC1_IRQHandler(void);
|
||||
void OTG_HS_EP1_OUT_IRQHandler(void);
|
||||
void OTG_HS_EP1_IN_IRQHandler(void);
|
||||
void OTG_HS_IRQHandler(void);
|
||||
void BDMA_Channel0_IRQHandler(void);
|
||||
void BDMA_Channel1_IRQHandler(void);
|
||||
void LPTIM4_IRQHandler(void);
|
||||
void LPUART1_IRQHandler(void);
|
||||
/* USER CODE BEGIN EFP */
|
||||
|
||||
/* USER CODE END EFP */
|
||||
|
||||
58
Core/Src/bdma.c
Normal file
58
Core/Src/bdma.c
Normal file
@@ -0,0 +1,58 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file bdma.c
|
||||
* @brief This file provides code for the configuration
|
||||
* of all the requested memory to memory DMA transfers.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2024 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "bdma.h"
|
||||
|
||||
/* USER CODE BEGIN 0 */
|
||||
|
||||
/* USER CODE END 0 */
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Configure DMA */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
/* USER CODE BEGIN 1 */
|
||||
|
||||
/* USER CODE END 1 */
|
||||
|
||||
/**
|
||||
* Enable DMA controller clock
|
||||
*/
|
||||
void MX_BDMA_Init(void)
|
||||
{
|
||||
|
||||
/* DMA controller clock enable */
|
||||
__HAL_RCC_BDMA_CLK_ENABLE();
|
||||
|
||||
/* DMA interrupt init */
|
||||
/* BDMA_Channel0_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(BDMA_Channel0_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(BDMA_Channel0_IRQn);
|
||||
/* BDMA_Channel1_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(BDMA_Channel1_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(BDMA_Channel1_IRQn);
|
||||
|
||||
}
|
||||
|
||||
/* USER CODE BEGIN 2 */
|
||||
|
||||
/* USER CODE END 2 */
|
||||
|
||||
@@ -163,6 +163,7 @@ void AddHeadlightMessages();
|
||||
#include "CLS_BSP.h"
|
||||
#include "CLSAddress.h"
|
||||
#include "mlzr_comm.h"
|
||||
#include "glasm.h"
|
||||
/* USER CODE END Header_StartDefaultTask */
|
||||
void StartDefaultTask(void *argument)
|
||||
{
|
||||
@@ -174,6 +175,7 @@ void StartDefaultTask(void *argument)
|
||||
|
||||
MLZR_INIT();
|
||||
|
||||
GLASM_Init();
|
||||
|
||||
retSD = f_mount(&SDFatFS,SDPath,0);
|
||||
retSD = f_open(&SDFile, "counter.bin", FA_READ);
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "main.h"
|
||||
#include "cmsis_os.h"
|
||||
#include "adc.h"
|
||||
#include "bdma.h"
|
||||
#include "crc.h"
|
||||
#include "dma.h"
|
||||
#include "fatfs.h"
|
||||
@@ -42,11 +43,14 @@
|
||||
#include "BSP_GPIO.h"
|
||||
#include "BSP_ADC.h"
|
||||
#include "ram_loader.h"
|
||||
#include "AsyncComm.h"
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN PTD */
|
||||
|
||||
extern uart_desc_t uart_half;
|
||||
__attribute__((__section__(".dma_buffer"))) uint8_t lp_buffer[2][2048] = {0};
|
||||
uint8_t swap_index = 0;
|
||||
/* USER CODE END PTD */
|
||||
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
@@ -61,7 +65,6 @@
|
||||
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
|
||||
// define the magic number for the bootloader 8 bytes
|
||||
/* USER CODE BEGIN PV */
|
||||
uint8_t gCLS_DEVICE_ADDRESS = 0x11;
|
||||
/* USER CODE END PV */
|
||||
@@ -121,6 +124,7 @@ int main(void)
|
||||
/* Initialize all configured peripherals */
|
||||
MX_GPIO_Init();
|
||||
MX_DMA_Init();
|
||||
MX_BDMA_Init();
|
||||
MX_I2C2_Init();
|
||||
MX_LPUART1_UART_Init();
|
||||
MX_USART1_UART_Init();
|
||||
@@ -133,8 +137,8 @@ int main(void)
|
||||
MX_I2C1_Init();
|
||||
MX_CRC_Init();
|
||||
MX_RNG_Init();
|
||||
MX_TIM2_Init();
|
||||
MX_LPTIM4_Init();
|
||||
MX_TIM2_Init();
|
||||
/* USER CODE BEGIN 2 */
|
||||
|
||||
BSP_GPIO_PeriperalsOn();
|
||||
@@ -145,6 +149,14 @@ int main(void)
|
||||
gCLS_DEVICE_ADDRESS = 0x11; // Address is set to master
|
||||
ULOG_DEBUG("Setting Global CLS address to 0b10001");
|
||||
ULOG_DEBUG("Init Kernel and start schedule");
|
||||
|
||||
//HAL_UART_Receive(&hlpuart1, lp_buffer[swap_index], 10, 10000);
|
||||
|
||||
HAL_StatusTypeDef status = HAL_UARTEx_ReceiveToIdle_DMA(&hlpuart1, lp_buffer[swap_index], 2048);
|
||||
if(status != HAL_OK){
|
||||
ULOG_ERROR("Failed to start DMA");
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
/* USER CODE END 2 */
|
||||
|
||||
@@ -168,6 +180,37 @@ int main(void)
|
||||
/* USER CODE END 3 */
|
||||
}
|
||||
|
||||
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart){
|
||||
if(huart->Instance ==LPUART1){
|
||||
uint8_t new_index = (swap_index + 1) % 2;
|
||||
HAL_UARTEx_ReceiveToIdle_DMA(&hlpuart1, lp_buffer[new_index], 2048);
|
||||
usart_send_data(&uart_half, lp_buffer[swap_index], 2048);
|
||||
swap_index = new_index;
|
||||
}
|
||||
}
|
||||
|
||||
void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size){
|
||||
//restarts the DMA listening of the UART rx (next 247 bytes)
|
||||
if(huart->Instance ==LPUART1){
|
||||
|
||||
uint8_t new_index = (swap_index + 1) % 2;
|
||||
HAL_UARTEx_ReceiveToIdle_DMA(&hlpuart1, lp_buffer[new_index], 2048);
|
||||
usart_send_data(&uart_half, lp_buffer[swap_index], Size);
|
||||
swap_index = new_index;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void HAL_UART_ErrorCallback(UART_HandleTypeDef *huart)
|
||||
{
|
||||
/* Prevent unused argument(s) compilation warning */
|
||||
if(huart->Instance ==LPUART1){
|
||||
swap_index = (swap_index + 1) % 2;
|
||||
HAL_UARTEx_ReceiveToIdle_DMA(&hlpuart1, lp_buffer[swap_index], 2048);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief System Clock Configuration
|
||||
* @retval None
|
||||
|
||||
@@ -63,6 +63,9 @@ extern ADC_HandleTypeDef hadc1;
|
||||
extern FDCAN_HandleTypeDef hfdcan1;
|
||||
extern FDCAN_HandleTypeDef hfdcan2;
|
||||
extern LPTIM_HandleTypeDef hlptim4;
|
||||
extern DMA_HandleTypeDef hdma_lpuart1_rx;
|
||||
extern DMA_HandleTypeDef hdma_lpuart1_tx;
|
||||
extern UART_HandleTypeDef hlpuart1;
|
||||
extern RTC_HandleTypeDef hrtc;
|
||||
extern SD_HandleTypeDef hsd1;
|
||||
extern TIM_HandleTypeDef htim2;
|
||||
@@ -475,6 +478,34 @@ void OTG_HS_IRQHandler(void)
|
||||
/* USER CODE END OTG_HS_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles BDMA channel0 global interrupt.
|
||||
*/
|
||||
void BDMA_Channel0_IRQHandler(void)
|
||||
{
|
||||
/* USER CODE BEGIN BDMA_Channel0_IRQn 0 */
|
||||
|
||||
/* USER CODE END BDMA_Channel0_IRQn 0 */
|
||||
HAL_DMA_IRQHandler(&hdma_lpuart1_rx);
|
||||
/* USER CODE BEGIN BDMA_Channel0_IRQn 1 */
|
||||
|
||||
/* USER CODE END BDMA_Channel0_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles BDMA channel1 global interrupt.
|
||||
*/
|
||||
void BDMA_Channel1_IRQHandler(void)
|
||||
{
|
||||
/* USER CODE BEGIN BDMA_Channel1_IRQn 0 */
|
||||
|
||||
/* USER CODE END BDMA_Channel1_IRQn 0 */
|
||||
HAL_DMA_IRQHandler(&hdma_lpuart1_tx);
|
||||
/* USER CODE BEGIN BDMA_Channel1_IRQn 1 */
|
||||
|
||||
/* USER CODE END BDMA_Channel1_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles LPTIM4 global interrupt.
|
||||
*/
|
||||
@@ -489,6 +520,22 @@ void LPTIM4_IRQHandler(void)
|
||||
/* USER CODE END LPTIM4_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles LPUART1 global interrupt.
|
||||
*/
|
||||
void LPUART1_IRQHandler(void)
|
||||
{
|
||||
/* USER CODE BEGIN LPUART1_IRQn 0 */
|
||||
|
||||
/* USER CODE END LPUART1_IRQn 0 */
|
||||
HAL_UART_IRQHandler(&hlpuart1);
|
||||
/* USER CODE BEGIN LPUART1_IRQn 1 */
|
||||
|
||||
|
||||
|
||||
/* USER CODE END LPUART1_IRQn 1 */
|
||||
}
|
||||
|
||||
/* USER CODE BEGIN 1 */
|
||||
|
||||
/* USER CODE END 1 */
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
/* USER CODE END 0 */
|
||||
|
||||
UART_HandleTypeDef hlpuart1;
|
||||
DMA_HandleTypeDef hdma_lpuart1_rx;
|
||||
DMA_HandleTypeDef hdma_lpuart1_tx;
|
||||
|
||||
/* LPUART1 init function */
|
||||
|
||||
@@ -39,7 +41,7 @@ void MX_LPUART1_UART_Init(void)
|
||||
|
||||
/* USER CODE END LPUART1_Init 1 */
|
||||
hlpuart1.Instance = LPUART1;
|
||||
hlpuart1.Init.BaudRate = 2000000;
|
||||
hlpuart1.Init.BaudRate = 3000000;
|
||||
hlpuart1.Init.WordLength = UART_WORDLENGTH_8B;
|
||||
hlpuart1.Init.StopBits = UART_STOPBITS_1;
|
||||
hlpuart1.Init.Parity = UART_PARITY_NONE;
|
||||
@@ -340,6 +342,44 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
|
||||
GPIO_InitStruct.Alternate = GPIO_AF8_LPUART;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
/* LPUART1 DMA Init */
|
||||
/* LPUART1_RX Init */
|
||||
hdma_lpuart1_rx.Instance = BDMA_Channel0;
|
||||
hdma_lpuart1_rx.Init.Request = BDMA_REQUEST_LPUART1_RX;
|
||||
hdma_lpuart1_rx.Init.Direction = DMA_PERIPH_TO_MEMORY;
|
||||
hdma_lpuart1_rx.Init.PeriphInc = DMA_PINC_DISABLE;
|
||||
hdma_lpuart1_rx.Init.MemInc = DMA_MINC_ENABLE;
|
||||
hdma_lpuart1_rx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
|
||||
hdma_lpuart1_rx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
|
||||
hdma_lpuart1_rx.Init.Mode = DMA_NORMAL;
|
||||
hdma_lpuart1_rx.Init.Priority = DMA_PRIORITY_LOW;
|
||||
if (HAL_DMA_Init(&hdma_lpuart1_rx) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
__HAL_LINKDMA(uartHandle,hdmarx,hdma_lpuart1_rx);
|
||||
|
||||
/* LPUART1_TX Init */
|
||||
hdma_lpuart1_tx.Instance = BDMA_Channel1;
|
||||
hdma_lpuart1_tx.Init.Request = BDMA_REQUEST_LPUART1_TX;
|
||||
hdma_lpuart1_tx.Init.Direction = DMA_MEMORY_TO_PERIPH;
|
||||
hdma_lpuart1_tx.Init.PeriphInc = DMA_PINC_DISABLE;
|
||||
hdma_lpuart1_tx.Init.MemInc = DMA_MINC_ENABLE;
|
||||
hdma_lpuart1_tx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
|
||||
hdma_lpuart1_tx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
|
||||
hdma_lpuart1_tx.Init.Mode = DMA_NORMAL;
|
||||
hdma_lpuart1_tx.Init.Priority = DMA_PRIORITY_LOW;
|
||||
if (HAL_DMA_Init(&hdma_lpuart1_tx) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
__HAL_LINKDMA(uartHandle,hdmatx,hdma_lpuart1_tx);
|
||||
|
||||
/* LPUART1 interrupt Init */
|
||||
HAL_NVIC_SetPriority(LPUART1_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(LPUART1_IRQn);
|
||||
/* USER CODE BEGIN LPUART1_MspInit 1 */
|
||||
|
||||
/* USER CODE END LPUART1_MspInit 1 */
|
||||
@@ -365,6 +405,12 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle)
|
||||
|
||||
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_6);
|
||||
|
||||
/* LPUART1 DMA DeInit */
|
||||
HAL_DMA_DeInit(uartHandle->hdmarx);
|
||||
HAL_DMA_DeInit(uartHandle->hdmatx);
|
||||
|
||||
/* LPUART1 interrupt Deinit */
|
||||
HAL_NVIC_DisableIRQ(LPUART1_IRQn);
|
||||
/* USER CODE BEGIN LPUART1_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END LPUART1_MspDeInit 1 */
|
||||
|
||||
@@ -171,6 +171,17 @@ SECTIONS
|
||||
. = ALIGN(8);
|
||||
} >RAM_D1
|
||||
|
||||
|
||||
.dma_buffer (NOLOAD):
|
||||
{
|
||||
/*_framebuffer =.; */
|
||||
/*__framebuffer_start__ = _framebuffer; */
|
||||
*(.dma_buffer)
|
||||
*(.dma_buffer*)
|
||||
|
||||
} >RAM_D3
|
||||
|
||||
|
||||
/* Remove information from the standard libraries */
|
||||
/DISCARD/ :
|
||||
{
|
||||
|
||||
@@ -22,6 +22,7 @@ set(sources_SRCS ${sources_SRCS}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Core/Src/adc.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Core/Src/crc.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Core/Src/dma.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Core/Src/bdma.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Core/Src/fdcan.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Core/Src/gpio.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Core/Src/i2c.c
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
// Use a SOF byte to mark the start of a frame
|
||||
#define TF_USE_SOF_BYTE 1
|
||||
// Value of the SOF byte (if TF_USE_SOF_BYTE == 1)
|
||||
#define TF_SOF_BYTE 0x01
|
||||
#define TF_SOF_BYTE 0x55
|
||||
|
||||
//----------------------- PLATFORM COMPATIBILITY ----------------------------
|
||||
|
||||
|
||||
2
proto
2
proto
Submodule proto updated: 37c0e46f59...c46afcd594
@@ -7,6 +7,7 @@ ${PROTO_SRC_DIR}/light.proto
|
||||
${PROTO_SRC_DIR}/usb.proto
|
||||
${PROTO_SRC_DIR}/cls_device.proto
|
||||
${PROTO_SRC_DIR}/headlight.proto
|
||||
${PROTO_SRC_DIR}/display.proto
|
||||
)
|
||||
|
||||
# Specify where you want to generate the python code
|
||||
|
||||
41
tools/display_test.py
Normal file
41
tools/display_test.py
Normal file
@@ -0,0 +1,41 @@
|
||||
import serial
|
||||
import struct
|
||||
from google.protobuf.message import DecodeError
|
||||
from serial.tools import list_ports
|
||||
|
||||
from display_pb2 import SetLayout
|
||||
from usb_pb2 import PackageType
|
||||
from vcp_driver import *
|
||||
|
||||
if __name__ == "__main__":
|
||||
ser = setup_connection()
|
||||
# Create a message
|
||||
#request = GlobalBrightness()
|
||||
#request.brightness = 100
|
||||
# Serialize the request to a bytearray
|
||||
#request_data = request.SerializeToString()
|
||||
|
||||
# Send the request
|
||||
#send_package(PackageType.LIGHT_GLOBAL_BRIGHT, request_data, ser)
|
||||
|
||||
|
||||
#request = GlobalTheme()
|
||||
#request.theme = 1
|
||||
#request_data = request.SerializeToString()
|
||||
#send_package(PackageType.LIGHT_GLOBAL_THEME, request_data, ser)
|
||||
|
||||
|
||||
# request = ThemeSettings()
|
||||
# request.deviceId = 1
|
||||
# request.theme = 1
|
||||
# request.rgb = 0x00f000f0
|
||||
# request.brightness = 255
|
||||
# request.animation = 2
|
||||
# request_data = request.SerializeToString()
|
||||
# send_package(PackageType.LIGHT_SETTING_THEME, request_data, ser)
|
||||
|
||||
|
||||
request = SetLayout()
|
||||
request.layout = 2
|
||||
request_data = request.SerializeToString()
|
||||
send_package(PackageType.DISPLAY_SET_LAYOUT, request_data, ser)
|
||||
13
tools/uart_in_test.py
Normal file
13
tools/uart_in_test.py
Normal file
@@ -0,0 +1,13 @@
|
||||
import serial
|
||||
|
||||
# Open the serial port
|
||||
ser = serial.Serial('/dev/ttyACM1', baudrate=1000000)
|
||||
|
||||
# Send 10 bytes of data
|
||||
data = b'01234567890123456789012345678901234567890123456789'
|
||||
|
||||
for i in range(10):
|
||||
ser.write(data)
|
||||
|
||||
# Close the serial port
|
||||
ser.close()
|
||||
Reference in New Issue
Block a user