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

GSM, USB, BLE and GPS are working.

Location:
ctrl/firmware/Main/CubeMX/Core/Src
Files:
3 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;
Note: See TracChangeset for help on using the changeset viewer.