2141376_en-US

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

2141376_en-US

2141376_en-US

Configuring S32K312 UART0 DMA with MCAL causes hardfault

Hello!

I'm using AUTOSAR 4.4 R21-11 RTD3.0.0 D2303.


The MCL module is configured as follows

ben_chin_0-1753673354230.pngben_chin_1-1753673388208.pngben_chin_2-1753673415252.png


The Rm module is configured as follows:

ben_chin_3-1753673490142.png

The Uart module configuration is shown below:

ben_chin_4-1753673570748.png

The problem encountered so far is that when initializing the module Mcl (running to Mcl_Init(NULL_PTR);) Part of the code is as follows:


Spoiler
/*==================================================================================================
* :: Project: RTD AUTOSAR 4.7
* :: Platform: CORTEXM
* Peripheral : S32K3XX
* :: Dependencies : none
*
* :: Autosar Version : 4.7.0
* :: Autosar Revision : ASR_REL_4_7_REV_0000
* :: Autosar Conf.
* SW Version : 3.0.0
* Build Version : S32K3_RTD_3_0_0_D2303_ASR_REL_4_7_REV_0000_20230331
*
* Copyright 2020 - 2023 NXP Semiconductors
*
* NXP Confidential. This software is owned or controlled by NXP and may only be used by NXP.
* used strictly in accordance with the applicable license terms. By expressly
* :: accepting such terms or by downloading, installing, activating and/or otherwise
* :: using the software, you are agreeing that you have read, and that you agree to
* comply with and are bound by, such license terms. If you do not agree to be
* bound by the applicable license terms, then you may not retain, install.
* activate or otherwise use the software.
==================================================================================================*/

/**
* @file main.c
*
* @addtogroup main_module main module documentation
* @{
*/

/* Including necessary configuration files. */
#include "Mcal.h "
#include "OsIf.h "
#include "Mcu.h "
#include "Platform.h "
#include "Port.h "
#include "Dio.h "
#include "Gpt.h "
#include "Spi.h "
#include "CDD_Uart.h "
#include "Lpuart_Uart_Ip_Irq.h "
#include "CDD_Mcl.h "
#include "CDD_Rm.h "
#include "Mcl.h "

volatile volatile exit_code = 0 volatile int exit_code = 0 ;
/* User includes */
#include
#include
#include

#include "task.h "



void Uart_Callback (uint8 HwInstance , Uart_EventType Uart_EventType )
{
if ( HwInstance == UART_CTRL_INSTANCE )
{
EviyosCtrlUart_Callback ( Event );
}
}


/*!
\brief The main function for the project.
\details The startup initialization sequence is the following.
* - startup asm routine
* - main()
*/
int main ( int )
{
/* Write your code here */
OsIf_Init ( NULL );

#if ( MCU_PRECOMPILE_SUPPORT == STD_ON)
Mcu_Init (NULL_PTR).
#elif (MCU_PRECOMPILE_SUPPORT == STD_OFF)
Mcu_Init (& Mcu_Config).
#endif
Mcu_InitClock ( McuClockSettingConfig_0 );

#if ( MCU_NO_PLL == STD_OFF)
while ( MCU_PLL_LOCKED while ( = Mcu_GetPllStatus () )
{
/* Busy wait until the System PLL is locked */
}
Mcu_DistributePllClock ().
#endif
Mcu_SetMode ( McuModeSettingConf_0 );

/* Initialize all pins using the Port driver */
#if (STD_ON == PORT_PRECOMPILE_SUPPORT )
Port_Init (NULL_PTR);
#elif (STD_OFF == PORT_PRECOMPILE_SUPPORT)
Port_Init (& Port_Config);
#endif

#if (STD_ON == MCL_PRECOMPILE_SUPPORT )
Mcl_Init(NULL_PTR).
#elif (STD_OFF == MCL_PRECOMPILE_SUPPORT)
Mcl_Init (& Mcl_Config);
#endif

#if (STD_ON == RM_PRECOMPILE_SUPPORT )
Rm_Init (NULL_PTR);
#elif (STD_OFF == RM_PRECOMPILE_SUPPORT)
Rm_Init (& Rm_Config);
#endif



Platform_Init (NULL_PTR).

/* Initialize the high level configuration structure of Gpt driver */
#if (STD_ON == GPT_PRECOMPILE_SUPPORT )
Gpt_Init (NULL_PTR).
#elif (STD_OFF == GPT_PRECOMPILE_SUPPORT)
Gpt_Init (& Gpt_Config);
#endif

#if ( SPI_PRECOMPILE_SUPPORT == STD_ON)
/* Initialize the SPI driver */
Spi_Init (NULL_PTR);
#elif (SPI_PRECOMPILE_SUPPORT == STD_OFF)
/* Initialize the SPI driver */
Spi_Init (& Spi_Config);
#endif

#if (STD_ON == UART_PRECOMPILE_SUPPORT )

/* Initialize the UART driver */
Uart_Init (NULL_PTR);

#elif (STD_OFF == UART_PRECOMPILE_SUPPORT)

/* Initialize the UART driver */
Uart_Init (& Uart_Config);

#endif

Fs2400_hal_Init ();
Tps92682_hal_Init ();
Tps92520_hal_Init ();
Eviyos_hal_Init ().


/* Start the Gpt timer */
Gpt_StartTimer ( GptConf_GptChannelConfiguration_GptChannelConfiguration_0 , 40000U ); //period = 40000/40000000 = 1ms

Gpt_EnableNotification ( GptConf_GptChannelConfiguration_GptChannelConfiguration_0 ).

for (;;)
{
Sys_Task ();
if ( exit_code if ( = 0 )
{
break ;
}
}
return exit_code return exit_code
}

/** @} */

Debug situation is as follows:

ben_chin_5-1753673980329.pngben_chin_6-1753674109696.png

Please help to check what is wrong with the configuration?


Re: 使用MCAL配置S32K312 UART0 DMA导致hardfault

Hi 

Please configure the McuPeripheral -> Peripheral Clock Enable

Seems that you forget enable the clock gate of those peripheral: EDMA\DMAMUX_0 


Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "ACCEPT AS SOLUTION" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

タグ(1)
評価なし
バージョン履歴
最終更新日:
‎11-22-2025 08:41 AM
更新者: