Ignore:
Timestamp:
Jan 21, 2025, 11:26:15 AM (4 days ago)
Author:
Zed
Message:

GSM, USB, BLE and GPS are working.

Location:
ctrl/firmware/Main/CubeMX
Files:
8 added
4 edited

Legend:

Unmodified
Added
Removed
  • ctrl/firmware/Main/CubeMX/Core/Src/app_threadx.c

    r64 r65  
    2828#include <stdio.h>
    2929
     30#include "tx_queue.h"
     31
    3032#include "keys_thread.h"
    3133#include "gsm_thread.h"
     34#include "gsm_rx_thread.h"
    3235
    3336/* USER CODE END Includes */
     
    4144/* USER CODE BEGIN PD */
    4245
    43 #define KEYS_THREAD_STACK_SIZE_BYTES    (1024U)
    44 #define GSM_THREAD_STACK_SIZE_BYTES             (1024U)
     46#define KEYS_THREAD_STACK_SIZE_BYTES            (1024U)
     47#define GSM_THREAD_STACK_SIZE_BYTES                     (1024U)
     48#define GSM_RX_THREAD_STACK_SIZE_BYTES          (1024U)
    4549
    4650/* USER CODE END PD */
     
    5660TX_THREAD scan_keys_thread_ptr;
    5761TX_THREAD gsm_thread_ptr;
     62TX_THREAD gsm_rx_thread_ptr;
    5863
    5964/* USER CODE END PV */
     
    7782  VOID *keys_thread_pointer;
    7883  VOID *gsm_thread_pointer;
     84  VOID *gsm_rx_thread_pointer;
    7985
    8086  /* USER CODE END App_ThreadX_MEM_POOL */
     
    98104  ret = tx_thread_create(&gsm_thread_ptr, gsm_thread_name, gsmThread, 0x0001,   gsm_thread_pointer, GSM_THREAD_STACK_SIZE_BYTES, TX_MAX_PRIORITIES-1, TX_MAX_PRIORITIES-1, TX_NO_TIME_SLICE, TX_AUTO_START);
    99105  if (ret != TX_SUCCESS) { printf("Cannot create %s!\n", gsm_thread_name); return ret; }
     106
     107  // Allocate the stack for gsm send thread
     108  ret = tx_byte_allocate(byte_pool, &gsm_rx_thread_pointer, GSM_RX_THREAD_STACK_SIZE_BYTES, TX_NO_WAIT);
     109  if (ret != TX_SUCCESS) { printf("Cannot allocate bytes of memory!\n"); return ret; }
     110
     111  char* gsm_rx_thread_name = "GSM RX Thread";
     112  ret = tx_thread_create(&gsm_rx_thread_ptr, gsm_rx_thread_name, gsmRxThread, 0x0001,   gsm_rx_thread_pointer, GSM_RX_THREAD_STACK_SIZE_BYTES, TX_MAX_PRIORITIES-1, TX_MAX_PRIORITIES-1, TX_NO_TIME_SLICE, TX_AUTO_START);
     113  if (ret != TX_SUCCESS) { printf("Cannot create %s!\n", gsm_rx_thread_name); return ret; }
    100114
    101115
  • ctrl/firmware/Main/CubeMX/Core/Src/stm32h7xx_it.c

    r64 r65  
    2424/* USER CODE BEGIN Includes */
    2525
    26 #include "gsm_thread.h"
     26#include "gsm_rx_thread.h"
    2727
    2828/* USER CODE END Includes */
     
    273273void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)
    274274{
    275         if (huart->Instance == USART3) gsmUnitSentData(Size);
     275        if (huart->Instance == USART3) gsmRxData(Size);
    276276}
    277277
  • ctrl/firmware/Main/CubeMX/Core/Src/usart.c

    r64 r65  
    130130    hdma_usart3_rx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
    131131    hdma_usart3_rx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
    132     hdma_usart3_rx.Init.Mode = DMA_CIRCULAR;
     132    hdma_usart3_rx.Init.Mode = DMA_NORMAL;
    133133    hdma_usart3_rx.Init.Priority = DMA_PRIORITY_LOW;
    134134    hdma_usart3_rx.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
  • ctrl/firmware/Main/CubeMX/charger.ioc

    r64 r65  
    33CAD.pinconfig=
    44CAD.provider=
     5CORTEX_M7.AccessPermission_S-Cortex_Memory_Protection_Unit_Region1_Settings_S=MPU_REGION_FULL_ACCESS
     6CORTEX_M7.BaseAddress_S-Cortex_Memory_Protection_Unit_Region1_Settings_S=0x30000000
    57CORTEX_M7.CPU_DCache=Enabled
    68CORTEX_M7.CPU_ICache=Enabled
    7 CORTEX_M7.IPParameters=default_mode_Activation,CPU_ICache,CPU_DCache
     9CORTEX_M7.DisableExec_S-Cortex_Memory_Protection_Unit_Region1_Settings_S=MPU_INSTRUCTION_ACCESS_DISABLE
     10CORTEX_M7.Enable_S-Cortex_Memory_Protection_Unit_Region1_Settings_S=MPU_REGION_ENABLE
     11CORTEX_M7.IPParameters=default_mode_Activation,CPU_ICache,CPU_DCache,Enable_S-Cortex_Memory_Protection_Unit_Region1_Settings_S,BaseAddress_S-Cortex_Memory_Protection_Unit_Region1_Settings_S,Size_S-Cortex_Memory_Protection_Unit_Region1_Settings_S,AccessPermission_S-Cortex_Memory_Protection_Unit_Region1_Settings_S,DisableExec_S-Cortex_Memory_Protection_Unit_Region1_Settings_S,IsShareable_S-Cortex_Memory_Protection_Unit_Region1_Settings_S
     12CORTEX_M7.IsShareable_S-Cortex_Memory_Protection_Unit_Region1_Settings_S=MPU_ACCESS_SHAREABLE
     13CORTEX_M7.Size_S-Cortex_Memory_Protection_Unit_Region1_Settings_S=MPU_REGION_SIZE_1KB
    814CORTEX_M7.default_mode_Activation=1
    915Dma.Request0=SPI4_TX
     
    3541Dma.USART3_RX.1.MemDataAlignment=DMA_MDATAALIGN_BYTE
    3642Dma.USART3_RX.1.MemInc=DMA_MINC_ENABLE
    37 Dma.USART3_RX.1.Mode=DMA_CIRCULAR
     43Dma.USART3_RX.1.Mode=DMA_NORMAL
    3844Dma.USART3_RX.1.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
    3945Dma.USART3_RX.1.PeriphInc=DMA_PINC_DISABLE
Note: See TracChangeset for help on using the changeset viewer.