R7FA4M2AD Issue with DTC and SCI9 – Master TrustZone Filter Error

Hello All,

I'm new to Renesas and currently working on configuring SCI9 as a UART to transmit and receive data.

Transmission and reception work fine, but I'm encountering issues when I try to use the DTC.

Specifically, I'm getting a Master TrustZone Filter Error, even though I am not intentionally using TrustZone.
When I check SAU.SFAR, I see the address 0x40118903, which points to &PBP_SCI->TDR.

Do I need to disable something if I'm not using TrustZone in my application?

My code: 

typedef struct

{

uint8_t MRA;

uint8_t MRB;

uint8_t RESERVED[2];

uint32_t SAR;

uint32_t DAR;

uint16_t CRA;

uint16_t CRB;

} dtc_transfer_information;

#define PBP_SCI R_SCI9

#define PBP_TIM R_GPT320

#define PBP_TIM_IRQn IEL0_IRQn

#define PBP_TIM_IRQHandler GPT0_COMPARE_C_IRQHandler

#define PBP_DMA_TX R_DTC

#define PBP_DMA_TX_IRQn IEL2_IRQn

#define PBP_USART_IRQn IEL1_IRQn

#define PBP_USART_IRQHandler SCI9_RXI_IRQHandler

#define PBP_TIMEOUT_μs 10000-1

static LPBP_Frame_t PBP_Frame; //!< Strukuta odbieranej ramki

static uint8_t PBP_Out_Buffer[1536]; //!< Bufor danych wyjściowych

dtc_transfer_information DTC_VECTOR[DTC_VECTOR_SIZE] __attribute__((aligned(1024)));

void PBP_Init(void)

{

DTC_VECTOR[PBP_DMA_TX_IRQn].MRA = 0

| DTC_MRA_SM_INC

| DTC_MRA_SZ_8bit

| DTC_MRA_MD_NORMAL;

DTC_VECTOR[PBP_DMA_TX_IRQn].MRB = 0

| DTC_MRB_DM_FIXED;

DTC_VECTOR[PBP_DMA_TX_IRQn].SAR = (uint32_t)&PBP_Out_Buffer[1];

DTC_VECTOR[PBP_DMA_TX_IRQn].DAR = (uint32_t)&PBP_SCI->TDR;

R_DTC->DTCVBR = (uint32_t) DTC_VECTOR;

PBP_TIM->GTCR = GPT_GTCR_MD_MODE_PWM | GPT_GTCR_TPCS_PCLKD_DIV32;

PBP_TIM->GTPR = 0xFFFFFFFF;

PBP_TIM->GTCCRC = PBP_TIMEOUT_μs;

PBP_TIM->GTCNT = 0x00000000;

PBP_TIM->GTST = 0;

NVIC_ClearPendingIRQ(PBP_TIM_IRQn);

NVIC_EnableIRQ(PBP_TIM_IRQn);

PBP_SCI->SMR = SCI_SMR_CKS_PCLK_DIV4; //CLK = 8Mhz

PBP_SCI->SPTR = 0

| SCI0_SPTR_SPB2DT_Msk

| SCI0_SPTR_SPB2IO_Msk;

// PBP_SCI->BRR = (uint8_t)((CLK_PCLKA / (32 * 9600U)) - 1);

PBP_SCI->BRR = 1;

PBP_SCI->SEMR = SCI0_SEMR_BRME_Msk; //Enable MDDR

PBP_SCI->MDDR = 236;

PBP_SCI->SCR = 0

| SCI0_SCR_RE_Msk

| SCI0_SCR_TE_Msk

| SCI0_SCR_TIE_Msk

| SCI0_SCR_RIE_Msk;

NVIC_ClearPendingIRQ(PBP_DMA_TX_IRQn);

NVIC_EnableIRQ(PBP_DMA_TX_IRQn);

R_ICU->IELSR2 = ICU_IELSRn_DTCE_EN | ICU_IELSRn_IELS(0x1B7); //ELC_EVENT_SCI9_TXI

NVIC_ClearPendingIRQ(PBP_USART_IRQn);

NVIC_EnableIRQ(PBP_USART_IRQn);

}

void send_USART_DMA(uint16_t size)

{

// for(uint16_t idx=0; idx<size; idx++)

// {

// PBP_SCI->TDR = PBP_Out_Buffer[idx];

// while((PBP_SCI->SSR & SCI0_SSR_TDRE_Msk) == 0);

// }

R_DTC->DTCST = 0;

DTC_VECTOR[PBP_DMA_TX_IRQn].CRA = size-1;

R_DTC->DTCST = DTC_DTCST_DTCST_Msk;

PBP_SCI->TDR = PBP_Out_Buffer[0];

while(DTC_VECTOR[PBP_DMA_TX_IRQn].CRA);

R_DTC->DTCST = 0;

while((PBP_SCI->SSR & SCI0_SSR_TDRE_Msk) == 0);

}

Any help would be appreciated.

Best regards,
Baterflu