SPIPWM the LEDs
This commit is contained in:
parent
04b95a19d1
commit
3b2dac7240
|
@ -0,0 +1,24 @@
|
|||
#ifndef INC_LEDS_H
|
||||
#define INC_LEDS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "stm32h7xx_hal.h"
|
||||
|
||||
#define N_LEDS 9
|
||||
|
||||
#define PWM_CHANNEL_R TIM_CHANNEL_1
|
||||
#define PWM_CHANNEL_G TIM_CHANNEL_2
|
||||
#define PWM_CHANNEL_B TIM_CHANNEL_3
|
||||
|
||||
void led_init(SPI_HandleTypeDef *spi, TIM_HandleTypeDef *pwmtim);
|
||||
|
||||
void led_set(size_t idx, uint8_t r, uint8_t g, uint8_t b);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // INC_LEDS_H
|
|
@ -54,9 +54,11 @@ void UsageFault_Handler(void);
|
|||
void DebugMon_Handler(void);
|
||||
void EXTI3_IRQHandler(void);
|
||||
void EXTI4_IRQHandler(void);
|
||||
void DMA1_Stream0_IRQHandler(void);
|
||||
void FDCAN1_IT0_IRQHandler(void);
|
||||
void FDCAN1_IT1_IRQHandler(void);
|
||||
void EXTI9_5_IRQHandler(void);
|
||||
void SPI3_IRQHandler(void);
|
||||
void TIM6_DAC_IRQHandler(void);
|
||||
void LTDC_IRQHandler(void);
|
||||
void TIM17_IRQHandler(void);
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
#include "leds.h"
|
||||
|
||||
#include "main.h"
|
||||
|
||||
#include "stm32h7xx_hal_dma.h"
|
||||
#include "stm32h7xx_hal_gpio.h"
|
||||
#include "stm32h7xx_hal_spi.h"
|
||||
#include "stm32h7xx_hal_tim.h"
|
||||
|
||||
SPI_HandleTypeDef *hspi;
|
||||
TIM_HandleTypeDef *htim;
|
||||
|
||||
extern uint16_t led_buf[256][3];
|
||||
static size_t led_buf_idx = 0;
|
||||
|
||||
void led_init(SPI_HandleTypeDef *spi, TIM_HandleTypeDef *pwmtim) {
|
||||
hspi = spi;
|
||||
htim = pwmtim;
|
||||
|
||||
HAL_GPIO_WritePin(LED_LE_GPIO_Port, LED_LE_Pin, GPIO_PIN_RESET);
|
||||
memset(led_buf, 0, sizeof(led_buf));
|
||||
|
||||
if (HAL_SPI_Transmit_DMA(hspi, (const uint8_t *)&led_buf[led_buf_idx], 3) !=
|
||||
HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
__HAL_TIM_SET_COMPARE(htim, PWM_CHANNEL_R, 0x3FFF);
|
||||
__HAL_TIM_SET_COMPARE(htim, PWM_CHANNEL_G, 0x13FF);
|
||||
__HAL_TIM_SET_COMPARE(htim, PWM_CHANNEL_B, 0x1FFF);
|
||||
if (HAL_TIM_PWM_Start(htim, PWM_CHANNEL_R) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
if (HAL_TIM_PWM_Start(htim, PWM_CHANNEL_G) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
if (HAL_TIM_PWM_Start(htim, PWM_CHANNEL_B) != HAL_OK) {
|
||||
Error_Handler();
|
||||
}
|
||||
}
|
||||
|
||||
void led_set(size_t idx, uint8_t r, uint8_t g, uint8_t b) {
|
||||
uint16_t led_set = (1 << idx);
|
||||
uint16_t led_unset = ~led_set;
|
||||
uint8_t rgb[] = {b, g, r};
|
||||
for (size_t time = 0; time < 256; time++) {
|
||||
// TODO: Shouldn't time only go up to 254?
|
||||
for (size_t i = 0; i < 3; i++) {
|
||||
if (time < rgb[i]) {
|
||||
led_buf[time][i] |= led_set;
|
||||
} else {
|
||||
led_buf[time][i] &= led_unset;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *handle) {
|
||||
if (handle != hspi) {
|
||||
return;
|
||||
}
|
||||
led_buf_idx = (led_buf_idx + 1) % 256;
|
||||
HAL_GPIO_WritePin(LED_LE_GPIO_Port, LED_LE_Pin, GPIO_PIN_SET);
|
||||
for (size_t i = 0; i < 10; i++) {
|
||||
asm("nop" ::: "memory");
|
||||
}
|
||||
HAL_GPIO_WritePin(LED_LE_GPIO_Port, LED_LE_Pin, GPIO_PIN_RESET);
|
||||
for (size_t i = 0; i < 10; i++) {
|
||||
asm("nop" ::: "memory");
|
||||
}
|
||||
HAL_SPI_Transmit_DMA(hspi, (const uint8_t *)&led_buf[led_buf_idx], 3);
|
||||
}
|
||||
|
||||
void HAL_SPI_ErrorCallback(SPI_HandleTypeDef *handle) {
|
||||
if (handle != hspi) {
|
||||
return;
|
||||
}
|
||||
volatile uint32_t err = HAL_DMA_GetError(hspi->hdmatx);
|
||||
err = err;
|
||||
}
|
|
@ -26,6 +26,7 @@
|
|||
#include "ft_logo_orange_rgb565.h"
|
||||
#include "ft_logo_rainbow_rgb565.h"
|
||||
#include "hx8357d.h"
|
||||
#include "leds.h"
|
||||
#include "shorttimer.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
@ -61,6 +62,7 @@ LTDC_HandleTypeDef hltdc;
|
|||
OSPI_HandleTypeDef hospi1;
|
||||
|
||||
SPI_HandleTypeDef hspi3;
|
||||
DMA_HandleTypeDef hdma_spi3_tx;
|
||||
|
||||
TIM_HandleTypeDef htim1;
|
||||
TIM_HandleTypeDef htim2;
|
||||
|
@ -75,7 +77,7 @@ volatile int ltdc_cb_triggered;
|
|||
/* Private function prototypes -----------------------------------------------*/
|
||||
void SystemClock_Config(void);
|
||||
static void MX_GPIO_Init(void);
|
||||
static void MX_DMA2D_Init(void);
|
||||
static void MX_DMA_Init(void);
|
||||
static void MX_FDCAN1_Init(void);
|
||||
static void MX_LTDC_Init(void);
|
||||
static void MX_JPEG_Init(void);
|
||||
|
@ -86,6 +88,7 @@ static void MX_TIM2_Init(void);
|
|||
static void MX_TIM4_Init(void);
|
||||
static void MX_CRC_Init(void);
|
||||
static void MX_TIM17_Init(void);
|
||||
static void MX_DMA2D_Init(void);
|
||||
/* USER CODE BEGIN PFP */
|
||||
|
||||
/* USER CODE END PFP */
|
||||
|
@ -123,7 +126,7 @@ int main(void) {
|
|||
|
||||
/* Initialize all configured peripherals */
|
||||
MX_GPIO_Init();
|
||||
MX_DMA2D_Init();
|
||||
MX_DMA_Init();
|
||||
MX_FDCAN1_Init();
|
||||
MX_LTDC_Init();
|
||||
MX_JPEG_Init();
|
||||
|
@ -134,6 +137,7 @@ int main(void) {
|
|||
MX_TIM4_Init();
|
||||
MX_CRC_Init();
|
||||
MX_TIM17_Init();
|
||||
MX_DMA2D_Init();
|
||||
/* Call PreOsInit function */
|
||||
MX_TouchGFX_PreOSInit();
|
||||
/* USER CODE BEGIN 2 */
|
||||
|
@ -141,6 +145,7 @@ int main(void) {
|
|||
Error_Handler();
|
||||
}
|
||||
shorttimer_init(htim_us);
|
||||
led_init(&hspi3, &htim1);
|
||||
|
||||
HX8357D_Init();
|
||||
|
||||
|
@ -480,7 +485,7 @@ static void MX_SPI3_Init(void) {
|
|||
hspi3.Instance = SPI3;
|
||||
hspi3.Init.Mode = SPI_MODE_MASTER;
|
||||
hspi3.Init.Direction = SPI_DIRECTION_2LINES_TXONLY;
|
||||
hspi3.Init.DataSize = SPI_DATASIZE_4BIT;
|
||||
hspi3.Init.DataSize = SPI_DATASIZE_12BIT;
|
||||
hspi3.Init.CLKPolarity = SPI_POLARITY_LOW;
|
||||
hspi3.Init.CLKPhase = SPI_PHASE_1EDGE;
|
||||
hspi3.Init.NSS = SPI_NSS_SOFT;
|
||||
|
@ -715,6 +720,20 @@ static void MX_TIM17_Init(void) {
|
|||
/* USER CODE END TIM17_Init 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable DMA controller clock
|
||||
*/
|
||||
static void MX_DMA_Init(void) {
|
||||
|
||||
/* DMA controller clock enable */
|
||||
__HAL_RCC_DMA1_CLK_ENABLE();
|
||||
|
||||
/* DMA interrupt init */
|
||||
/* DMA1_Stream0_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(DMA1_Stream0_IRQn, 0, 0);
|
||||
HAL_NVIC_EnableIRQ(DMA1_Stream0_IRQn);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief GPIO Initialization Function
|
||||
* @param None
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
extern DMA_HandleTypeDef hdma_spi3_tx;
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN TD */
|
||||
|
@ -627,7 +628,15 @@ void HAL_SPI_MspInit(SPI_HandleTypeDef* hspi)
|
|||
/** Initializes the peripherals clock
|
||||
*/
|
||||
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_SPI3;
|
||||
PeriphClkInitStruct.Spi123ClockSelection = RCC_SPI123CLKSOURCE_PLL;
|
||||
PeriphClkInitStruct.PLL2.PLL2M = 2;
|
||||
PeriphClkInitStruct.PLL2.PLL2N = 11;
|
||||
PeriphClkInitStruct.PLL2.PLL2P = 66;
|
||||
PeriphClkInitStruct.PLL2.PLL2Q = 3;
|
||||
PeriphClkInitStruct.PLL2.PLL2R = 2;
|
||||
PeriphClkInitStruct.PLL2.PLL2RGE = RCC_PLL2VCIRANGE_3;
|
||||
PeriphClkInitStruct.PLL2.PLL2VCOSEL = RCC_PLL2VCOWIDE;
|
||||
PeriphClkInitStruct.PLL2.PLL2FRACN = 0;
|
||||
PeriphClkInitStruct.Spi123ClockSelection = RCC_SPI123CLKSOURCE_PLL2;
|
||||
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
|
@ -648,6 +657,28 @@ void HAL_SPI_MspInit(SPI_HandleTypeDef* hspi)
|
|||
GPIO_InitStruct.Alternate = GPIO_AF6_SPI3;
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||
|
||||
/* SPI3 DMA Init */
|
||||
/* SPI3_TX Init */
|
||||
hdma_spi3_tx.Instance = DMA1_Stream0;
|
||||
hdma_spi3_tx.Init.Request = DMA_REQUEST_SPI3_TX;
|
||||
hdma_spi3_tx.Init.Direction = DMA_MEMORY_TO_PERIPH;
|
||||
hdma_spi3_tx.Init.PeriphInc = DMA_PINC_DISABLE;
|
||||
hdma_spi3_tx.Init.MemInc = DMA_MINC_ENABLE;
|
||||
hdma_spi3_tx.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD;
|
||||
hdma_spi3_tx.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD;
|
||||
hdma_spi3_tx.Init.Mode = DMA_NORMAL;
|
||||
hdma_spi3_tx.Init.Priority = DMA_PRIORITY_LOW;
|
||||
hdma_spi3_tx.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
|
||||
if (HAL_DMA_Init(&hdma_spi3_tx) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
__HAL_LINKDMA(hspi,hdmatx,hdma_spi3_tx);
|
||||
|
||||
/* SPI3 interrupt Init */
|
||||
HAL_NVIC_SetPriority(SPI3_IRQn, 0, 0);
|
||||
HAL_NVIC_EnableIRQ(SPI3_IRQn);
|
||||
/* USER CODE BEGIN SPI3_MspInit 1 */
|
||||
|
||||
/* USER CODE END SPI3_MspInit 1 */
|
||||
|
@ -677,6 +708,11 @@ void HAL_SPI_MspDeInit(SPI_HandleTypeDef* hspi)
|
|||
*/
|
||||
HAL_GPIO_DeInit(GPIOC, LED_CP_Pin|LED_D_Pin);
|
||||
|
||||
/* SPI3 DMA DeInit */
|
||||
HAL_DMA_DeInit(hspi->hdmatx);
|
||||
|
||||
/* SPI3 interrupt DeInit */
|
||||
HAL_NVIC_DisableIRQ(SPI3_IRQn);
|
||||
/* USER CODE BEGIN SPI3_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END SPI3_MspDeInit 1 */
|
||||
|
|
|
@ -57,6 +57,8 @@
|
|||
/* External variables --------------------------------------------------------*/
|
||||
extern FDCAN_HandleTypeDef hfdcan1;
|
||||
extern LTDC_HandleTypeDef hltdc;
|
||||
extern DMA_HandleTypeDef hdma_spi3_tx;
|
||||
extern SPI_HandleTypeDef hspi3;
|
||||
extern TIM_HandleTypeDef htim17;
|
||||
extern TIM_HandleTypeDef htim6;
|
||||
|
||||
|
@ -190,6 +192,20 @@ void EXTI4_IRQHandler(void)
|
|||
/* USER CODE END EXTI4_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles DMA1 stream0 global interrupt.
|
||||
*/
|
||||
void DMA1_Stream0_IRQHandler(void)
|
||||
{
|
||||
/* USER CODE BEGIN DMA1_Stream0_IRQn 0 */
|
||||
|
||||
/* USER CODE END DMA1_Stream0_IRQn 0 */
|
||||
HAL_DMA_IRQHandler(&hdma_spi3_tx);
|
||||
/* USER CODE BEGIN DMA1_Stream0_IRQn 1 */
|
||||
|
||||
/* USER CODE END DMA1_Stream0_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles FDCAN1 interrupt 0.
|
||||
*/
|
||||
|
@ -233,6 +249,20 @@ void EXTI9_5_IRQHandler(void)
|
|||
/* USER CODE END EXTI9_5_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles SPI3 global interrupt.
|
||||
*/
|
||||
void SPI3_IRQHandler(void)
|
||||
{
|
||||
/* USER CODE BEGIN SPI3_IRQn 0 */
|
||||
|
||||
/* USER CODE END SPI3_IRQn 0 */
|
||||
HAL_SPI_IRQHandler(&hspi3);
|
||||
/* USER CODE BEGIN SPI3_IRQn 1 */
|
||||
|
||||
/* USER CODE END SPI3_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles TIM6 global interrupt, DAC1_CH1 and DAC1_CH2 underrun error interrupts.
|
||||
*/
|
||||
|
|
2
Makefile
2
Makefile
|
@ -1,5 +1,5 @@
|
|||
##########################################################################################################################
|
||||
# File automatically-generated by tool: [projectgenerator] version: [3.19.2] date: [Fri Mar 17 18:17:40 CET 2023]
|
||||
# File automatically-generated by tool: [projectgenerator] version: [3.19.2] date: [Fri Mar 24 19:11:35 CET 2023]
|
||||
##########################################################################################################################
|
||||
|
||||
# ------------------------------------------------
|
||||
|
|
|
@ -17,7 +17,7 @@ targetMCU: stm32h7x
|
|||
cpu: cortex-m7 # type of cpu e.g. cortex-m4
|
||||
fpu: fpv5-d16 # Defines how floating points are defined. Can be left empty.
|
||||
floatAbi: -mfloat-abi=hard
|
||||
ldscript: STM32H7A3ZITx_FLASH.ld # linker script
|
||||
ldscript: STM32H7A3ZITx_FLASH_nocube.ld # linker script
|
||||
|
||||
# Compiler definitions. The -D prefix for the compiler will be automatically added.
|
||||
cDefinitions:
|
||||
|
|
|
@ -0,0 +1,208 @@
|
|||
/*
|
||||
******************************************************************************
|
||||
**
|
||||
|
||||
** File : LinkerScript.ld
|
||||
**
|
||||
** Author : STM32CubeMX
|
||||
**
|
||||
** Abstract : Linker script for STM32H7A3ZITx series
|
||||
** 2048Kbytes FLASH and 1216Kbytes RAM
|
||||
**
|
||||
** Set heap size, stack size and stack location according
|
||||
** to application requirements.
|
||||
**
|
||||
** Set memory bank area and size if external memory is used.
|
||||
**
|
||||
** Target : STMicroelectronics STM32
|
||||
**
|
||||
** Distribution: The file is distributed “as is,” without any warranty
|
||||
** of any kind.
|
||||
**
|
||||
*****************************************************************************
|
||||
** @attention
|
||||
**
|
||||
** <h2><center>© COPYRIGHT(c) 2019 STMicroelectronics</center></h2>
|
||||
**
|
||||
** 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 STMicroelectronics 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 HOLDER 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.
|
||||
**
|
||||
*****************************************************************************
|
||||
*/
|
||||
|
||||
/* Entry Point */
|
||||
ENTRY(Reset_Handler)
|
||||
|
||||
/* Highest address of the user mode stack */
|
||||
_estack = ORIGIN(DTCMRAM) + LENGTH(DTCMRAM); /* end of RAM */
|
||||
/* Generate a link error if heap and stack don't fit into RAM */
|
||||
_Min_Heap_Size = 0x200; /* required amount of heap */
|
||||
_Min_Stack_Size = 0x400; /* required amount of stack */
|
||||
|
||||
/* Specify the memory areas */
|
||||
MEMORY
|
||||
{
|
||||
DTCMRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
|
||||
RAM (xrw) : ORIGIN = 0x24000000, LENGTH = 1024K
|
||||
AHBSRAM (xrw) : ORIGIN = 0x30000000, LENGTH = 128K
|
||||
ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K
|
||||
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 2048K
|
||||
}
|
||||
|
||||
/* Define output sections */
|
||||
SECTIONS
|
||||
{
|
||||
/* The startup code goes first into FLASH */
|
||||
.isr_vector :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
KEEP(*(.isr_vector)) /* Startup code */
|
||||
. = ALIGN(4);
|
||||
} >FLASH
|
||||
|
||||
/* The program code and other data goes into FLASH */
|
||||
.text :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
*(.text) /* .text sections (code) */
|
||||
*(.text*) /* .text* sections (code) */
|
||||
*(.glue_7) /* glue arm to thumb code */
|
||||
*(.glue_7t) /* glue thumb to arm code */
|
||||
*(.eh_frame)
|
||||
|
||||
KEEP (*(.init))
|
||||
KEEP (*(.fini))
|
||||
|
||||
. = ALIGN(4);
|
||||
_etext = .; /* define a global symbols at end of code */
|
||||
} >FLASH
|
||||
|
||||
/* Constant data goes into FLASH */
|
||||
.rodata :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
*(.rodata) /* .rodata sections (constants, strings, etc.) */
|
||||
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
|
||||
. = ALIGN(4);
|
||||
} >FLASH
|
||||
|
||||
.ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
|
||||
.ARM : {
|
||||
__exidx_start = .;
|
||||
*(.ARM.exidx*)
|
||||
__exidx_end = .;
|
||||
} >FLASH
|
||||
|
||||
.preinit_array :
|
||||
{
|
||||
PROVIDE_HIDDEN (__preinit_array_start = .);
|
||||
KEEP (*(.preinit_array*))
|
||||
PROVIDE_HIDDEN (__preinit_array_end = .);
|
||||
} >FLASH
|
||||
.init_array :
|
||||
{
|
||||
PROVIDE_HIDDEN (__init_array_start = .);
|
||||
KEEP (*(SORT(.init_array.*)))
|
||||
KEEP (*(.init_array*))
|
||||
PROVIDE_HIDDEN (__init_array_end = .);
|
||||
} >FLASH
|
||||
.fini_array :
|
||||
{
|
||||
PROVIDE_HIDDEN (__fini_array_start = .);
|
||||
KEEP (*(SORT(.fini_array.*)))
|
||||
KEEP (*(.fini_array*))
|
||||
PROVIDE_HIDDEN (__fini_array_end = .);
|
||||
} >FLASH
|
||||
|
||||
/* used by the startup to initialize data */
|
||||
_sidata = LOADADDR(.data);
|
||||
|
||||
/* Initialized data sections goes into RAM, load LMA copy after code */
|
||||
.data :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
_sdata = .; /* create a global symbol at data start */
|
||||
*(.data) /* .data sections */
|
||||
*(.data*) /* .data* sections */
|
||||
|
||||
. = ALIGN(4);
|
||||
_edata = .; /* define a global symbol at data end */
|
||||
} >DTCMRAM AT> FLASH
|
||||
|
||||
|
||||
/* Uninitialized data section */
|
||||
. = ALIGN(4);
|
||||
.bss :
|
||||
{
|
||||
/* This is used by the startup in order to initialize the .bss secion */
|
||||
_sbss = .; /* define a global symbol at bss start */
|
||||
__bss_start__ = _sbss;
|
||||
*(.bss)
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
|
||||
. = ALIGN(4);
|
||||
_ebss = .; /* define a global symbol at bss end */
|
||||
__bss_end__ = _ebss;
|
||||
} >DTCMRAM
|
||||
|
||||
._threadx_heap :
|
||||
{
|
||||
. = ALIGN(8);
|
||||
__RAM_segment_used_end__ = .;
|
||||
. = . + 64K;
|
||||
. = ALIGN(8);
|
||||
} >RAM_D1 AT> RAM_D1
|
||||
|
||||
/* User_heap_stack section, used to check that there is enough RAM left */
|
||||
._user_heap_stack :
|
||||
{
|
||||
. = ALIGN(8);
|
||||
PROVIDE ( end = . );
|
||||
PROVIDE ( _end = . );
|
||||
. = . + _Min_Heap_Size;
|
||||
. = . + _Min_Stack_Size;
|
||||
. = ALIGN(8);
|
||||
} >DTCMRAM
|
||||
|
||||
._led_dma_buf :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
led_buf = .;
|
||||
. = . + 768;
|
||||
. = ALIGN(4);
|
||||
} >AHBSRAM
|
||||
|
||||
|
||||
|
||||
/* Remove information from the standard libraries */
|
||||
/DISCARD/ :
|
||||
{
|
||||
libc.a ( * )
|
||||
libm.a ( * )
|
||||
libgcc.a ( * )
|
||||
}
|
||||
|
||||
.ARM.attributes 0 : { *(.ARM.attributes) }
|
||||
}
|
||||
|
||||
|
|
@ -41,6 +41,7 @@ Core/Lib/can-halal/can-halal.c \
|
|||
Core/Src/app.c \
|
||||
Core/Src/app_threadx.c \
|
||||
Core/Src/hx8357d.c \
|
||||
Core/Src/leds.c \
|
||||
Core/Src/shorttimer.c \
|
||||
Core/Src/stm32h7xx_hal_msp.c \
|
||||
Core/Src/stm32h7xx_hal_timebase_tim.c \
|
||||
|
@ -528,7 +529,7 @@ CXXFLAGS += -MMD -MP -MF"$(@:%.o=%.d)"
|
|||
# LDFLAGS
|
||||
#######################################
|
||||
# link script
|
||||
LDSCRIPT = STM32H7A3ZITx_FLASH.ld
|
||||
LDSCRIPT = STM32H7A3ZITx_FLASH_nocube.ld
|
||||
|
||||
# libraries
|
||||
LIBS = -lc -lm -lnosys -ltouchgfx-float-abi-hard
|
||||
|
|
|
@ -122,7 +122,7 @@ DriverViewViewBase::DriverViewViewBase() :
|
|||
prechargeProgress.setRange(0, 100);
|
||||
prechargeProgress.setDirection(touchgfx::AbstractDirectionProgress::RIGHT);
|
||||
prechargeProgress.setBackground(touchgfx::Bitmap(BITMAP_PRECHARGE_BG_ID));
|
||||
prechargeProgress.setColor(touchgfx::Color::getColorFromRGB(136, 255, 0));
|
||||
prechargeProgress.setColor(touchgfx::Color::getColorFromRGB(99, 186, 0));
|
||||
prechargeProgress.setValue(0);
|
||||
prechargeProgress.setVisible(false);
|
||||
add(prechargeProgress);
|
||||
|
|
|
@ -440,8 +440,8 @@
|
|||
"Height": 55,
|
||||
"Visible": false,
|
||||
"Color": {
|
||||
"Red": 136,
|
||||
"Green": 255
|
||||
"Red": 99,
|
||||
"Green": 186
|
||||
},
|
||||
"Direction": "Right",
|
||||
"FileNameBackground": "precharge_bg.png",
|
||||
|
|
|
@ -5,6 +5,26 @@ CAD.pinconfig=
|
|||
CAD.provider=
|
||||
DMA2D.ColorMode=DMA2D_OUTPUT_RGB888
|
||||
DMA2D.IPParameters=ColorMode
|
||||
Dma.Request0=SPI3_TX
|
||||
Dma.RequestsNb=1
|
||||
Dma.SPI3_TX.0.Direction=DMA_MEMORY_TO_PERIPH
|
||||
Dma.SPI3_TX.0.EventEnable=DISABLE
|
||||
Dma.SPI3_TX.0.FIFOMode=DMA_FIFOMODE_DISABLE
|
||||
Dma.SPI3_TX.0.Instance=DMA1_Stream0
|
||||
Dma.SPI3_TX.0.MemDataAlignment=DMA_MDATAALIGN_HALFWORD
|
||||
Dma.SPI3_TX.0.MemInc=DMA_MINC_ENABLE
|
||||
Dma.SPI3_TX.0.Mode=DMA_NORMAL
|
||||
Dma.SPI3_TX.0.PeriphDataAlignment=DMA_PDATAALIGN_HALFWORD
|
||||
Dma.SPI3_TX.0.PeriphInc=DMA_PINC_DISABLE
|
||||
Dma.SPI3_TX.0.Polarity=HAL_DMAMUX_REQ_GEN_RISING
|
||||
Dma.SPI3_TX.0.Priority=DMA_PRIORITY_LOW
|
||||
Dma.SPI3_TX.0.RequestNumber=1
|
||||
Dma.SPI3_TX.0.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode,SignalID,Polarity,RequestNumber,SyncSignalID,SyncPolarity,SyncEnable,EventEnable,SyncRequestNumber
|
||||
Dma.SPI3_TX.0.SignalID=NONE
|
||||
Dma.SPI3_TX.0.SyncEnable=DISABLE
|
||||
Dma.SPI3_TX.0.SyncPolarity=HAL_DMAMUX_SYNC_NO_EVENT
|
||||
Dma.SPI3_TX.0.SyncRequestNumber=1
|
||||
Dma.SPI3_TX.0.SyncSignalID=NONE
|
||||
FDCAN1.CalculateBaudRateNominal=500000
|
||||
FDCAN1.CalculateTimeBitNominal=2000
|
||||
FDCAN1.CalculateTimeQuantumNominal=25.0
|
||||
|
@ -43,21 +63,22 @@ Mcu.CPN=STM32H7A3ZIT6
|
|||
Mcu.Family=STM32H7
|
||||
Mcu.IP0=CORTEX_M7
|
||||
Mcu.IP1=CRC
|
||||
Mcu.IP10=SPI3
|
||||
Mcu.IP11=SYS
|
||||
Mcu.IP12=TIM1
|
||||
Mcu.IP13=TIM2
|
||||
Mcu.IP14=TIM4
|
||||
Mcu.IP15=TIM17
|
||||
Mcu.IP10=RCC
|
||||
Mcu.IP11=SPI3
|
||||
Mcu.IP12=SYS
|
||||
Mcu.IP13=TIM1
|
||||
Mcu.IP14=TIM2
|
||||
Mcu.IP15=TIM4
|
||||
Mcu.IP16=TIM17
|
||||
Mcu.IP2=DEBUG
|
||||
Mcu.IP3=DMA2D
|
||||
Mcu.IP4=FDCAN1
|
||||
Mcu.IP5=JPEG
|
||||
Mcu.IP6=LTDC
|
||||
Mcu.IP7=NVIC
|
||||
Mcu.IP8=OCTOSPI1
|
||||
Mcu.IP9=RCC
|
||||
Mcu.IPNb=16
|
||||
Mcu.IP3=DMA
|
||||
Mcu.IP4=DMA2D
|
||||
Mcu.IP5=FDCAN1
|
||||
Mcu.IP6=JPEG
|
||||
Mcu.IP7=LTDC
|
||||
Mcu.IP8=NVIC
|
||||
Mcu.IP9=OCTOSPI1
|
||||
Mcu.IPNb=17
|
||||
Mcu.Name=STM32H7A3Z(G-I)Tx
|
||||
Mcu.Package=LQFP144
|
||||
Mcu.Pin0=PE2
|
||||
|
@ -145,6 +166,7 @@ MxCube.Version=6.8.0
|
|||
MxDb.Version=DB.6.0.80
|
||||
NRST.Locked=true
|
||||
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false
|
||||
NVIC.DMA1_Stream0_IRQn=true\:0\:0\:false\:false\:true\:true\:false\:true\:true
|
||||
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false
|
||||
NVIC.EXTI3_IRQn=true\:0\:0\:false\:false\:true\:false\:true\:true\:true
|
||||
NVIC.EXTI4_IRQn=true\:0\:0\:false\:false\:true\:false\:true\:true\:true
|
||||
|
@ -158,6 +180,7 @@ NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:
|
|||
NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false
|
||||
NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:false\:false\:false\:false\:false
|
||||
NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
|
||||
NVIC.SPI3_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:true\:true
|
||||
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:false\:false\:false\:false\:false
|
||||
NVIC.SavedPendsvIrqHandlerGenerated=true
|
||||
NVIC.SavedSvcallIrqHandlerGenerated=true
|
||||
|
@ -423,8 +446,8 @@ ProjectManager.StackSize=0x400
|
|||
ProjectManager.TargetToolchain=Makefile
|
||||
ProjectManager.ToolChainLocation=
|
||||
ProjectManager.UnderRoot=false
|
||||
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_DMA2D_Init-DMA2D-false-HAL-true,4-MX_FDCAN1_Init-FDCAN1-false-HAL-true,5-MX_LTDC_Init-LTDC-false-HAL-true,6-MX_JPEG_Init-JPEG-false-HAL-true,7-MX_OCTOSPI1_Init-OCTOSPI1-false-HAL-true,8-MX_SPI3_Init-SPI3-false-HAL-true,9-MX_TIM1_Init-TIM1-false-HAL-true,10-MX_TIM2_Init-TIM2-false-HAL-true,11-MX_TIM4_Init-TIM4-false-HAL-true,12-MX_CRC_Init-CRC-false-HAL-true,13-MX_TouchGFX_Init-STMicroelectronics.X-CUBE-TOUCHGFX.4.21.2-false-HAL-false,14-MX_TouchGFX_Process-STMicroelectronics.X-CUBE-TOUCHGFX.4.21.2-false-HAL-false,0-MX_CORTEX_M7_Init-CORTEX_M7-false-HAL-true
|
||||
RCC.ADCFreq_Value=24000000
|
||||
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,4-MX_DMA_Init-DMA-false-HAL-true,5-MX_FDCAN1_Init-FDCAN1-false-HAL-true,6-MX_LTDC_Init-LTDC-false-HAL-true,7-MX_JPEG_Init-JPEG-false-HAL-true,8-MX_OCTOSPI1_Init-OCTOSPI1-false-HAL-true,9-MX_SPI3_Init-SPI3-false-HAL-true,10-MX_TIM1_Init-TIM1-false-HAL-true,11-MX_TIM2_Init-TIM2-false-HAL-true,12-MX_TIM4_Init-TIM4-false-HAL-true,13-MX_CRC_Init-CRC-false-HAL-true,14-MX_TIM17_Init-TIM17-false-HAL-true,15-MX_DMA2D_Init-DMA2D-false-HAL-true,17-MX_TouchGFX_Init-STMicroelectronics.X-CUBE-TOUCHGFX.4.21.2-false-HAL-false,18-MX_TouchGFX_Process-STMicroelectronics.X-CUBE-TOUCHGFX.4.21.2-false-HAL-false,0-MX_CORTEX_M7_Init-CORTEX_M7-false-HAL-true
|
||||
RCC.ADCFreq_Value=2000000
|
||||
RCC.AHB12Freq_Value=160000000
|
||||
RCC.AHB4Freq_Value=160000000
|
||||
RCC.APB1Freq_Value=80000000
|
||||
|
@ -447,21 +470,22 @@ RCC.DFSDM2Freq_Value=80000000
|
|||
RCC.DFSDMACLkFreq_Value=80000000
|
||||
RCC.DFSDMFreq_Value=80000000
|
||||
RCC.DIVM1=3
|
||||
RCC.DIVM2=4
|
||||
RCC.DIVM2=2
|
||||
RCC.DIVM3=2
|
||||
RCC.DIVN1=40
|
||||
RCC.DIVN2=8
|
||||
RCC.DIVN2=11
|
||||
RCC.DIVN3=15
|
||||
RCC.DIVP1Freq_Value=160000000
|
||||
RCC.DIVP2Freq_Value=24000000
|
||||
RCC.DIVP2=66
|
||||
RCC.DIVP2Freq_Value=2000000
|
||||
RCC.DIVP3Freq_Value=90000000
|
||||
RCC.DIVQ1=4
|
||||
RCC.DIVQ1Freq_Value=80000000
|
||||
RCC.DIVQ2=3
|
||||
RCC.DIVQ2Freq_Value=16000000
|
||||
RCC.DIVQ2Freq_Value=44000000
|
||||
RCC.DIVQ3Freq_Value=90000000
|
||||
RCC.DIVR1Freq_Value=160000000
|
||||
RCC.DIVR2Freq_Value=24000000
|
||||
RCC.DIVR2Freq_Value=66000000
|
||||
RCC.DIVR3=18
|
||||
RCC.DIVR3Freq_Value=10000000
|
||||
RCC.FDCANFreq_Value=80000000
|
||||
|
@ -472,7 +496,7 @@ RCC.HCLKFreq_Value=160000000
|
|||
RCC.HSE_VALUE=24000000
|
||||
RCC.I2C123Freq_Value=80000000
|
||||
RCC.I2C4Freq_Value=80000000
|
||||
RCC.IPParameters=ADCFreq_Value,AHB12Freq_Value,AHB4Freq_Value,APB1Freq_Value,APB2Freq_Value,APB3Freq_Value,APB4Freq_Value,AXIClockFreq_Value,CDCPREFreq_Value,CDPPRE,CDPPRE1,CDPPRE2,CECFreq_Value,CKPERFreq_Value,CortexFreq_Value,CpuClockFreq_Value,DAC1Freq_Value,DAC2Freq_Value,DFSDM2ACLkFreq_Value,DFSDM2Freq_Value,DFSDMACLkFreq_Value,DFSDMFreq_Value,DIVM1,DIVM2,DIVM3,DIVN1,DIVN2,DIVN3,DIVP1Freq_Value,DIVP2Freq_Value,DIVP3Freq_Value,DIVQ1,DIVQ1Freq_Value,DIVQ2,DIVQ2Freq_Value,DIVQ3Freq_Value,DIVR1Freq_Value,DIVR2Freq_Value,DIVR3,DIVR3Freq_Value,FDCANFreq_Value,FMCFreq_Value,FamilyName,HCLK3ClockFreq_Value,HCLKFreq_Value,HSE_VALUE,I2C123Freq_Value,I2C4Freq_Value,LPTIM1Freq_Value,LPTIM2Freq_Value,LPTIM345Freq_Value,LPUART1Freq_Value,LTDCFreq_Value,MCO1PinFreq_Value,MCO2PinFreq_Value,PLLSourceVirtual,QSPIFreq_Value,RNGFreq_Value,RTCFreq_Value,SAI1Freq_Value,SAI2AFreq_Value,SAI2BFreq_Value,SDMMCFreq_Value,SPDIFRXFreq_Value,SPI123Freq_Value,SPI45Freq_Value,SPI6Freq_Value,SRDPPRE,SWPMI1Freq_Value,SYSCLKFreq_VALUE,SYSCLKSource,Tim1OutputFreq_Value,Tim2OutputFreq_Value,TraceFreq_Value,USART16Freq_Value,USART234578Freq_Value,USBFreq_Value,VCO1OutputFreq_Value,VCO2OutputFreq_Value,VCO3OutputFreq_Value,VCOInput1Freq_Value,VCOInput2Freq_Value,VCOInput3Freq_Value
|
||||
RCC.IPParameters=ADCFreq_Value,AHB12Freq_Value,AHB4Freq_Value,APB1Freq_Value,APB2Freq_Value,APB3Freq_Value,APB4Freq_Value,AXIClockFreq_Value,CDCPREFreq_Value,CDPPRE,CDPPRE1,CDPPRE2,CECFreq_Value,CKPERFreq_Value,CortexFreq_Value,CpuClockFreq_Value,DAC1Freq_Value,DAC2Freq_Value,DFSDM2ACLkFreq_Value,DFSDM2Freq_Value,DFSDMACLkFreq_Value,DFSDMFreq_Value,DIVM1,DIVM2,DIVM3,DIVN1,DIVN2,DIVN3,DIVP1Freq_Value,DIVP2,DIVP2Freq_Value,DIVP3Freq_Value,DIVQ1,DIVQ1Freq_Value,DIVQ2,DIVQ2Freq_Value,DIVQ3Freq_Value,DIVR1Freq_Value,DIVR2Freq_Value,DIVR3,DIVR3Freq_Value,FDCANFreq_Value,FMCFreq_Value,FamilyName,HCLK3ClockFreq_Value,HCLKFreq_Value,HSE_VALUE,I2C123Freq_Value,I2C4Freq_Value,LPTIM1Freq_Value,LPTIM2Freq_Value,LPTIM345Freq_Value,LPUART1Freq_Value,LTDCFreq_Value,MCO1PinFreq_Value,MCO2PinFreq_Value,PLLSourceVirtual,QSPIFreq_Value,RNGFreq_Value,RTCFreq_Value,SAI1Freq_Value,SAI2AFreq_Value,SAI2BFreq_Value,SDMMCFreq_Value,SPDIFRXFreq_Value,SPI123CLockSelection,SPI123Freq_Value,SPI45Freq_Value,SPI6Freq_Value,SRDPPRE,SWPMI1Freq_Value,SYSCLKFreq_VALUE,SYSCLKSource,Tim1OutputFreq_Value,Tim2OutputFreq_Value,TraceFreq_Value,USART16Freq_Value,USART234578Freq_Value,USBFreq_Value,VCO1OutputFreq_Value,VCO2OutputFreq_Value,VCO3OutputFreq_Value,VCOInput1Freq_Value,VCOInput2Freq_Value,VCOInput3Freq_Value
|
||||
RCC.LPTIM1Freq_Value=80000000
|
||||
RCC.LPTIM2Freq_Value=80000000
|
||||
RCC.LPTIM345Freq_Value=80000000
|
||||
|
@ -489,7 +513,8 @@ RCC.SAI2AFreq_Value=80000000
|
|||
RCC.SAI2BFreq_Value=80000000
|
||||
RCC.SDMMCFreq_Value=80000000
|
||||
RCC.SPDIFRXFreq_Value=80000000
|
||||
RCC.SPI123Freq_Value=80000000
|
||||
RCC.SPI123CLockSelection=RCC_SPI123CLKSOURCE_PLL2
|
||||
RCC.SPI123Freq_Value=2000000
|
||||
RCC.SPI45Freq_Value=80000000
|
||||
RCC.SPI6Freq_Value=80000000
|
||||
RCC.SRDPPRE=RCC_APB4_DIV2
|
||||
|
@ -503,10 +528,10 @@ RCC.USART16Freq_Value=80000000
|
|||
RCC.USART234578Freq_Value=80000000
|
||||
RCC.USBFreq_Value=80000000
|
||||
RCC.VCO1OutputFreq_Value=320000000
|
||||
RCC.VCO2OutputFreq_Value=48000000
|
||||
RCC.VCO2OutputFreq_Value=132000000
|
||||
RCC.VCO3OutputFreq_Value=180000000
|
||||
RCC.VCOInput1Freq_Value=8000000
|
||||
RCC.VCOInput2Freq_Value=6000000
|
||||
RCC.VCOInput2Freq_Value=12000000
|
||||
RCC.VCOInput3Freq_Value=12000000
|
||||
SH.GPXTI3.0=GPIO_EXTI3
|
||||
SH.GPXTI3.ConfNb=1
|
||||
|
@ -529,9 +554,10 @@ SH.S_TIM4_CH1.ConfNb=1
|
|||
SH.S_TIM4_CH2.0=TIM4_CH2,PWM Generation2 CH2
|
||||
SH.S_TIM4_CH2.ConfNb=1
|
||||
SPI3.BaudRatePrescaler=SPI_BAUDRATEPRESCALER_2
|
||||
SPI3.CalculateBaudRate=40.0 MBits/s
|
||||
SPI3.CalculateBaudRate=1000.0 KBits/s
|
||||
SPI3.DataSize=SPI_DATASIZE_12BIT
|
||||
SPI3.Direction=SPI_DIRECTION_2LINES_TXONLY
|
||||
SPI3.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate,BaudRatePrescaler
|
||||
SPI3.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate,BaudRatePrescaler,DataSize
|
||||
SPI3.Mode=SPI_MODE_MASTER
|
||||
SPI3.VirtualType=VM_MASTER
|
||||
STMicroelectronics.X-CUBE-AZRTOS-H7.3.0.0.AZRTOS_APP_MEM_ALLOCATION_METHOD=0
|
||||
|
|
Loading…
Reference in New Issue