I want to implement BLDC 6 Step control.
- MCSPTE1AK344 development board used
- 6 PWM outputs used
- 3 digital inputs used for Hall Sensor value
- I opened and worked on the PWM example project
And I am planning to use FreeMASTER to check the operation of PWM output and digital input in the above project.
How can I add FreeMASTER to the above project?
※ I opened the FreeMASTER example and confirmed that FreeMASTER is working
Hi @trunie1,
Here are the steps needed to add FreeMASTER Driver into your project:
(this will add links to FreeMASTER source and header files to your PWM project).
#define FMSTR_LONG_INTR 0 // If 1 FMSTR_SerialIsr should handle the UART interrupt
#define FMSTR_SHORT_INTR 1 // If 1 FMSTR_SerialIsr should handle the UART interrupt
#define FMSTR_POLL_DRIVEN 0 // Does not require setting UART interrupt
Next steps are similar to the FreeMASTER example application:
#include "freemaster.h"
#include "freemaster_s32k3xx_lpuart.h"
/* Set UART base address */
FMSTR_SerialSetBaseAddress((FMSTR_ADDR)LPUART_6_BASE);
/* Initialize FreeMASTER */
FMSTR_Init();
for (;;) {
FMSTR_Poll();
}
Hope it helps,
Iulian
First of all, I would like you to explain process 2 in detail. I don't understand what I should do.
And when I build after adding the code from steps 3 to 5, the following error occurs.
error : ../src/main.c:132:44: error: 'LPUART_6_BASE' undeclared (first use in this function); did you mean 'LPUART6_CLK'?
In this regard, the FMSTR_SerialSetBaseAddress((FMSTR_ADDR)LPUART_2_BASE) function is used in the fmstr_uart_s32k344 example project of S32DS. So I searched for the location where the 'LPUART_2_BASE' parameter was declared.
- 'LPUART_2_BASE' : S32K344.h
The above S32K344.h file did not exist in my project (Pwm_example_S32K344 used).
To resolve the build error, should I copy the above header file and add it inside the project folder?
[error happened]
[S32K344.h at fmstr_uart_s32k344 example project]
RTD (Real Time Drivers) has a slight different project structure. The platform specific header files are stored in "C:\NXP\S32DS.3.5\S32DS\software\PlatformSDK_S32K3\RTD\BaseNXP_TS_T40D34M30I0R0\header"
LPUART specific register information is defined in S32K344_LPUART.h:
You can use numeric value of the UART instance or a macro IP_LPUART_X_BASE (in the later case you need to include S32K344_LPUART.h header file.)
Hello.
I solved the error by including the S32K344_LPUART.h file.
However, I don't know how to configure UART pins, clock, and peripherals. I would like you to explain in detail.
The current situation is as follows.
1. Build without UART code of frmst_uart_s32k344 example project
1) FreeMASTER is connected
2) When I add a variable declared in main.c, the message 'Symbol not found' appears.
2. An error occurs when building by adding the UART code of frmst_uart_s32k344 example project
Hi @trunie1,
IClock, Pins and UART configuration is done via UI using S32 Configuration Tools. It is quite intuitive and has help (F1) information.
Clock (most likely it is already configured for you):
Pins:
Peripherals:
Here you will need to add/update the following 3 MCAL components: Uart, Port (for SIUL config) and Platform (for UART interrupt). You can use Uart_Example_S32K344 example project as reference:
You can find more information about Configuration Tools in "C:\NXP\S32DS.3.5\Release_Notes\S32_Configuration_Tools_Release_Notes.pdf". For further assistance on configuration please refer to S32 Design Studio community space.
1. FreeMASTER throws that error due to missing symbolic information. This information is extracted from the DWARF section of your ELF file. Refer to "Symbol files" (ch. 5.2 of the User Manual).
IF you already provided it, you can check the list of all extracted symbols by pressing the "View" button to double check whether that symbol was extracted.
Note: the ELF file should be build with enabled debug information.
2. Those errors are caused by helper functions/macros are not defined in your project. They are defined inside FreeMASTER project (not part of RTD/SDK). Even if you copy-paste the header file where those are defined into your project, it won't work because of different register notation (you saw it in case of UART base address).