]> git.leonardobizzoni.com Git - pioneer-stm32/commitdiff
opening serial in non-exclusive mode works
authorFederica Di Lauro <federicadilauro1998@gmail.com>
Mon, 10 Feb 2020 10:18:44 +0000 (11:18 +0100)
committerFederica Di Lauro <federicadilauro1998@gmail.com>
Mon, 10 Feb 2020 10:18:44 +0000 (11:18 +0100)
otto_controller/.mxproject
otto_controller/Core/Src/main.cpp
otto_controller/otto_controller.ioc
utils/py_serial_examples/receive.py
utils/py_serial_examples/transmit.py

index 2d84f4e53ea7a45f0b9a147ff8d6cccbf74091ad..d4029ca30195bb502f862efc2dd6e141ae4f1ddd 100644 (file)
@@ -18,6 +18,8 @@ HeaderFiles#5=/home/fdila/Projects/otto/otto_controller/Core/Inc/main.h
 SourceFiles#3=/home/fdila/Projects/otto/otto_controller/Core/Src/stm32f7xx_it.c\r
 SourceFiles#4=/home/fdila/Projects/otto/otto_controller/Core/Src/stm32f7xx_hal_msp.c\r
 SourceFiles#5=/home/fdila/Projects/otto/otto_controller/Core/Src/main.c\r
+HeaderFiles#6=/home/fdila/Projects/otto/otto_controller/Core/Inc/main.h\r
+SourceFiles#6=/home/fdila/Projects/otto/otto_controller/Core/Src/main.c\r
 \r
 [PreviousLibFiles]\r
 LibFiles=Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_cortex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_tim.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_tim_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rcc.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rcc_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_flash.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_flash_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_gpio.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_gpio_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dma.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dma_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_pwr.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_pwr_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_def.h;Drivers/STM32F7xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_i2c.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_i2c_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_exti.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_uart.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_uart_ex.h;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_cortex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_tim.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_tim_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_rcc.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_rcc_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_flash.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_flash_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_gpio.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_dma.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_dma_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_pwr.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_pwr_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_i2c.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_i2c_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_exti.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_uart.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_uart_ex.c;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_cortex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_tim.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_tim_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rcc.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rcc_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_flash.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_flash_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_gpio.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_gpio_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dma.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dma_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_pwr.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_pwr_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_def.h;Drivers/STM32F7xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_i2c.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_i2c_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_exti.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_uart.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_uart_ex.h;Drivers/CMSIS/Device/ST/STM32F7xx/Include/stm32f767xx.h;Drivers/CMSIS/Device/ST/STM32F7xx/Include/stm32f7xx.h;Drivers/CMSIS/Device/ST/STM32F7xx/Include/system_stm32f7xx.h;Drivers/CMSIS/Device/ST/STM32F7xx/Source/Templates/system_stm32f7xx.c;Drivers/CMSIS/Include/cmsis_gcc.h;Drivers/CMSIS/Include/core_cm3.h;Drivers/CMSIS/Include/core_armv8mml.h;Drivers/CMSIS/Include/cmsis_armcc.h;Drivers/CMSIS/Include/core_sc300.h;Drivers/CMSIS/Include/core_cm33.h;Drivers/CMSIS/Include/core_cm0.h;Drivers/CMSIS/Include/core_cm1.h;Drivers/CMSIS/Include/tz_context.h;Drivers/CMSIS/Include/cmsis_armclang.h;Drivers/CMSIS/Include/core_cm7.h;Drivers/CMSIS/Include/cmsis_compiler.h;Drivers/CMSIS/Include/cmsis_iccarm.h;Drivers/CMSIS/Include/core_cm23.h;Drivers/CMSIS/Include/core_armv8mbl.h;Drivers/CMSIS/Include/core_cm0plus.h;Drivers/CMSIS/Include/mpu_armv7.h;Drivers/CMSIS/Include/mpu_armv8.h;Drivers/CMSIS/Include/cmsis_version.h;Drivers/CMSIS/Include/core_sc000.h;Drivers/CMSIS/Include/core_cm4.h;\r
index be12c515172e7bc275fb5cad2805c6eac61f2291..f152d592a22570119131683249b0e1d0527225aa 100644 (file)
@@ -198,7 +198,8 @@ void SystemClock_Config(void) {
   /** Configure the main internal regulator output voltage \r
    */\r
   __HAL_RCC_PWR_CLK_ENABLE();\r
-  __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE3);/** Initializes the CPU, AHB and APB busses clocks\r
+  __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE3);\r
+  /** Initializes the CPU, AHB and APB busses clocks \r
    */\r
   RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;\r
   RCC_OscInitStruct.HSIState = RCC_HSI_ON;\r
@@ -233,13 +234,13 @@ void SystemClock_Config(void) {
 static void MX_NVIC_Init(void) {\r
   /* TIM3_IRQn interrupt configuration */\r
   HAL_NVIC_SetPriority(TIM3_IRQn, 2, 1);\r
-  HAL_NVIC_EnableIRQ (TIM3_IRQn);\r
+  HAL_NVIC_EnableIRQ(TIM3_IRQn);\r
   /* TIM6_DAC_IRQn interrupt configuration */\r
   HAL_NVIC_SetPriority(TIM6_DAC_IRQn, 2, 2);\r
-  HAL_NVIC_EnableIRQ (TIM6_DAC_IRQn);\r
+  HAL_NVIC_EnableIRQ(TIM6_DAC_IRQn);\r
   /* USART6_IRQn interrupt configuration */\r
   HAL_NVIC_SetPriority(USART6_IRQn, 1, 0);\r
-  HAL_NVIC_EnableIRQ (USART6_IRQn);\r
+  HAL_NVIC_EnableIRQ(USART6_IRQn);\r
 }\r
 \r
 /* USER CODE BEGIN 4 */\r
index 51bdd3c32c26c6adffa816d8e05f9d008731f646..bf656e6915c059dcd805f510005b8d197a60e965 100644 (file)
@@ -167,7 +167,7 @@ ProjectManager.StackSize=0x400
 ProjectManager.TargetToolchain=STM32CubeIDE
 ProjectManager.ToolChainLocation=
 ProjectManager.UnderRoot=true
-ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_TIM2_Init-TIM2-false-HAL-true,4-MX_TIM3_Init-TIM3-false-HAL-true,5-MX_TIM4_Init-TIM4-false-HAL-true,6-MX_TIM5_Init-TIM5-false-HAL-true,7-MX_USART6_UART_Init-USART6-false-HAL-true,8-MX_CORTEX_M7_Init-CORTEX_M7-false-HAL-true,9-MX_TIM6_Init-TIM6-false-HAL-true
+ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,1-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_TIM2_Init-TIM2-false-HAL-true,4-MX_TIM3_Init-TIM3-false-HAL-true,5-MX_TIM4_Init-TIM4-false-HAL-true,6-MX_TIM5_Init-TIM5-false-HAL-true,7-MX_USART6_UART_Init-USART6-false-HAL-true,8-MX_CORTEX_M7_Init-CORTEX_M7-false-HAL-true,9-MX_TIM6_Init-TIM6-false-HAL-true
 RCC.CECFreq_Value=32786.88524590164
 RCC.DFSDMFreq_Value=16000000
 RCC.FamilyName=M
index 94fc687fe5c8f1ce98edc7a06e22b3b7cc527c4a..93b974ab7bd4179c0c9b8aecdd004768d054a33c 100644 (file)
@@ -5,7 +5,8 @@ ser = serial.Serial(
         parity=serial.PARITY_NONE,
         stopbits=serial.STOPBITS_ONE,
         bytesize=serial.EIGHTBITS,
-        rtscts=False)
+        rtscts=False,
+        exclusive=None)
 while (ser.is_open == False):
        try:
                ser.port = '/dev/ttyUSB0'
index 63f9bc4503ec67d3a9c843f8568bb9b9bcb328d9..90aabb8b93d2dfc09185b24fa13181051c718588 100644 (file)
@@ -6,7 +6,8 @@ ser = serial.Serial(
         parity=serial.PARITY_NONE,
         stopbits=serial.STOPBITS_ONE,
         bytesize=serial.EIGHTBITS,
-        rtscts=False)
+        rtscts=False,
+        exclusive=None)
 while (ser.is_open == False):
        try:
                ser.port = '/dev/ttyUSB0'
@@ -17,9 +18,9 @@ while (ser.is_open == False):
 
 print("open port")
 ang_vel_cmd = 0
-lin_vel_cmd = 1
+lin_vel_cmd = 0.5
 while 1:
-       msg_output_buffer = struct.pack('<ff', ang_vel_cmd, lin_vel_cmd)
+       msg_output_buffer = struct.pack('<ff', lin_vel_cmd, ang_vel_cmd)
        ser.write(msg_output_buffer)
        print(ang_vel_cmd)
        print(lin_vel_cmd)