2024-10-23 04:11 AM - edited 2024-10-23 07:50 AM
Hello,
as the title says, I wanna use the display with the µC.
Aim:
The aim is just to learn to know how to use SPI. And for the begin I want to use only a display with a ready to go driver. The display runs with the driver ili9341. I just wanna give text outputs to the display.
Reccources:
I searched an STM-compatible: ILI9341-HAL-Driver-afikson
A website (also with a link to the data sheet) for the display: MSP2202
STM32G431 User Manual: UM2397
I use the STM32CubeIDE.
What I already configured:
Cube settings (Pinout & Configuration):
Driver programming files (ili and fonts) editing:
Source code files editing and IDE settings:
private function prototype field
/* USER CODE BEGIN PFP */
void init() {
ILI9341_Unselect();
ILI9341_TouchUnselect();
ILI9341_Init();
}
/* USER CODE END PFP */
/* USER CODE BEGIN Init */
init();
/* USER CODE END Init */
What errors hapened?:
12:37:42 **** Incremental Build of configuration Debug for project SPI_display_MSP2202_Iili9341 ****
make -j16 all
arm-none-eabi-gcc -mcpu=cortex-m4 -g3 -DDEBUG -c -x assembler-with-cpp -MMD -MP -MF"Core/Startup/startup_stm32g431kbtx.d" -MT"Core/Startup/startup_stm32g431kbtx.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Core/Startup/startup_stm32g431kbtx.o" "../Core/Startup/startup_stm32g431kbtx.s"
../Core/Startup/startup_stm32g431kbtx.s: Assembler messages:
../Core/Startup/startup_stm32g431kbtx.s:155: Error: symbol `Reset_Handler' is already defined
../Core/Startup/startup_stm32g431kbtx.s:169: Error: symbol `CopyDataInit' is already defined
../Core/Startup/startup_stm32g431kbtx.s:174: Error: symbol `LoopCopyDataInit' is already defined
../Core/Startup/startup_stm32g431kbtx.s:185: Error: symbol `FillZerobss' is already defined
../Core/Startup/startup_stm32g431kbtx.s:595: Error: symbol `LoopForever' is already defined
../Core/Startup/startup_stm32g431kbtx.s:609: Error: symbol `Default_Handler' is already defined
../Core/Startup/startup_stm32g431kbtx.s:610: Error: symbol `Infinite_Loop' is already defined
../Core/Startup/startup_stm32g431kbtx.s:624: Error: symbol `g_pfnVectors' is already defined
C:\Users\a4763\AppData\Local\Temp\ccAChdPF.s: Error: invalid operands (.isr_vector and .text.Reset_Handler sections) for `-'
C:\Users\a4763\AppData\Local\Temp\ccAChdPF.s: Error: .size expression for Reset_Handler does not evaluate to a constant
make: *** [Core/Startup/subdir.mk:19: Core/Startup/startup_stm32g431kbtx.o] Error 1
"make -j16 all" terminated with exit code 2. Build might be incomplete.
12:37:42 Build Failed. 9 errors, 0 warnings. (took 342ms)
____________________________________________________________________________________________
My questions:
Addendum 23.10.24, 14:20:
I forgot to mention, that the main.c is lined weirdly, like it has no permission or something.
Addendum 23.10.24, 16:48:
So sorry, I typed a wrong link for the ili9341 lib, I corrected it now. Before it was the one by ardnew.
But the current and correct one is the one by afikson.
2024-10-23 07:40 AM
I found the issue.
I cannot help, but because of anything the code part of the assembly file I mentioned until
"
FillZerobss:
str r3, [r2]
adds r2, r2, #4
"
was indeed copied and pasted after the first one, so the symbols was double existent. And that is not all, there was more parts nonsenseful copied. Very weird.
So I decided to create a new project with the settings and code changes I mentioned.
I will comment the results.
2024-10-23 08:30 AM
So, now I could normally work on my project.
I added includes to main.c:
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include <string.h>
#include <stdarg.h>
#include "ili9341.h"
#include "fonts.h"
/* USER CODE END Includes */
The while loop in the main function:
while (1)
{
/* USER CODE END WHILE */
HAL_Delay(500);
ILI9341_WriteString(0, 0, "TEST", Font_7x10, ILI9341_RED, ILI9341_BLACK);
HAL_Delay(500);
ILI9341_WriteString(0, 0, "HELLO WORLD", Font_7x10, ILI9341_RED, ILI9341_BLACK);
/* USER CODE BEGIN 3 */
}
So now I can build it without errors or warnings. I connected the controller to the display on my breadboard and played the program to the controller.
The display only displays a white screen. That could be because, I have to set better parameters for the Bits and prescaler for the SPI config in the ioc file (or in the cube).
I will comment again, when I am ready.
2024-10-29 05:11 AM - edited 2024-10-29 05:12 AM
Someone has written a helping comment, but it is away. Can someone help pls?
By the way, is this post at the correct area? I am new here.