AUTOSAR MPC5777C_MCAL4_0_RTM_1_0_1 SPI ASYNCTRANSMIT not working truth with DMA Module

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

AUTOSAR MPC5777C_MCAL4_0_RTM_1_0_1 SPI ASYNCTRANSMIT not working truth with DMA Module

Jump to solution
2,052 Views
Macar
Contributor III

Hello NXP Team, I installed the MPC5777C_MCAL4_0_RTM_1_0_1  package from the NXP Web site, but I have a problem using async SPI with DMA,  I set my first channel with 1 byte, my data is coming out. I set my 2nd channel with 4 bytes, but only 1 byte is output and the output data is the last data of my 2nd channel, the data of the next channels are not output. In short, the communication does not work properly when I use it with asynchronous spi dma. I shared my relevant codes and EB tresos configuration files in the zip file.

0 Kudos
1 Solution
1,765 Views
Macar
Contributor III

Hello, I activated IGF for the relevant ICU pin and the interrupt started to appear, In the sample project you sent, IGF is configured for the relevant ICU pin. but I could not fully understand why. Thank you very much for your help. 

Macar_0-1684906055573.png

 

View solution in original post

0 Kudos
15 Replies
1,759 Views
Nhi_Nguyen
NXP Employee
NXP Employee

Hi Macar,

This is information that I found in RM about this:

Nhi_Nguyen_0-1684910185451.pngNhi_Nguyen_1-1684910190906.png

You can find more detail in chapter 39.

This is also note for me in this platform.

Anyway, I'm glad that you can manage this issue.

Best regards,

Nhi

0 Kudos
1,978 Views
Nhi_Nguyen
NXP Employee
NXP Employee

Hi Macar,

I attached an example for async mode transmit.

To have more information about this mode, you can refer to the chapter 5.3 of AUTOSAR_MCAL_MCAL_IM.pdf in package.

Nhi_Nguyen_0-1684329334343.png

 

I have some notes follow my example:

Nhi_Nguyen_1-1684329914649.png

Install interrupt:

Nhi_Nguyen_2-1684330007548.png

Nhi_Nguyen_3-1684330151457.png

In the file Vector_vle_mcal.s:

Nhi_Nguyen_4-1684330217270.png

To configure Mcl Dma Transfer Completion User Notification, you can refer to chapter 5.4 of IM:

Nhi_Nguyen_5-1684330364173.png

So, to transmit multiple channels in a job and a sequence as your example, driver will follow above diagram. Trigger to transmit data in first channel, data transmitted from tx channel DMA, because TxDMA channel link to Rx DMA channel, so

Nhi_Nguyen_6-1684330946832.png

Best regards,

Nhi

0 Kudos
1,737 Views
ONUR
Contributor I

Hello,

I made all the details as in the photo you send and I see it as you see it, but I send 3 bytes of data in the 1st channel I set, only 1 byte of data is output. The data that comes out is the last data I sent in the channel. Since 3 bytes in the 1st channel are not output, no data of the 2nd channel is output either.Can you help ?

Thanks.

0 Kudos
1,625 Views
ONUR
Contributor I

I can't reach your tresos settings, it gives xlm error, can you take screenshots?

Thanks Nhi.

0 Kudos
1,584 Views
Nhi_Nguyen
NXP Employee
NXP Employee

Hi Macar,

I attached images in the zip file.

Best regards,

Nhi

0 Kudos
1,636 Views
Nhi_Nguyen
NXP Employee
NXP Employee

Hi Macar,

As I said before, each time we can go into the interrupt function ISR(MCL_DMA_CH_13_ISR) => It means TX linked to RX and have data received at Rx already and in this function interrupt handler, we will continue to handle to the next channel in the remaining channels that were configured in job to transmit but not transmitted yet.

Nhi_Nguyen_0-1685070801718.png

So you can go into this function Spi_Dspi_IsrDmaRx() 

Nhi_Nguyen_1-1685071845024.png

So, how much times did you go into this function?

In my example that attached in previous reply, I could go into 4 times for 4 channels configured in that job.

Best regards,

Nhi

0 Kudos
1,950 Views
Macar
Contributor III

hello thank you very much for your support i checked your answer and i will try to fix my code, actually i have problem similar to this interrupt problem. I configured the ICU driver and I call the necessary APIs, but I can't get interrupts, no interrupts. I connected my EMIOS_CH_0 PWM channel to my EMIOS_CH_6 ICU channel with a jumper, but the interrupt does not come

note: I can see the pwm signal in emios_ch_0.

Macar_2-1684408812552.png

 

Macar_0-1684408717100.png

 

Macar_1-1684408738169.png

 

0 Kudos
1,923 Views
Nhi_Nguyen
NXP Employee
NXP Employee

Hi Macar,

I just run an example that was attached in the package MPC5777C_MCAL4_0_RTM_1_0_1 and I also leave it here. It is same your scenario. You can try to run it.

From my site, I can see interrupt flag of Icu_Emios raise and go into the function interrupt handler as below:

Nhi_Nguyen_0-1684593253932.png

I think you can try to set priority for interrupts that you want to use, because default is 0 that has lowest priority as below:

Nhi_Nguyen_1-1684592861198.pngNhi_Nguyen_2-1684592866471.png

And register interrupt address (the function) MCU will go into when interrupt flag raised. For example:

Nhi_Nguyen_3-1684593006657.png

You can find all of them in this example that was attached in this post.

Best regards,

Nhi

 

0 Kudos
1,839 Views
Macar
Contributor III

I increased the interrupt priority but still no interrupt

 

Macar_0-1684737725843.png

Macar_1-1684737786919.png

 

0 Kudos
1,823 Views
Macar
Contributor III
Even though I connected the pwm output to the icu input, I still couldn't get interrupt even though I increased the interrupt priority.
0 Kudos
1,811 Views
Nhi_Nguyen
NXP Employee
NXP Employee

Hi Macar, 

Did you see this bit raised or not?

Nhi_Nguyen_0-1684813015181.png

 

If it raised as above image, Icu catched input signal already. Then, you will need to check software handler that assigned to this interrupt. It is corresponding to case 2 in my previous reply:

Nhi_Nguyen_1-1684813266808.png

 

Each IRQ has a register to save the function handler address as description below:

Nhi_Nguyen_2-1684815213083.pngNhi_Nguyen_6-1684815329128.png

 

Nhi_Nguyen_7-1684815336213.pngNhi_Nguyen_8-1684815354475.pngNhi_Nguyen_9-1684815375078.png

It means you need to create a vector table and assign interrupt handlers to them. This will be done in startup. For example:

vector table defined in the file: Vector_vle_mcal.s

Memory for this area that was defined in the file: autosar_flash

Load them to write to register in the file: Startup_vle

Anyway, I attached an example in the previous repply. You can refer to it.

Best regards,

Nhi

 

0 Kudos
1,805 Views
Macar
Contributor III

Hi, I already have vector table and startup codes, and I have successfully used a different emios channel and interrupt for the GPTdriver. but I can't use it for ic.

Macar_0-1684819384779.png

 

Macar_1-1684820871521.png

meanwhile no interrupt occurs

0 Kudos
1,802 Views
Macar
Contributor III

As far as I understand, the problem is the installation of interrupt is not vector table vs. emios cannot create interrupt, it does not see the pwm signal and the flag is not raised.,Could the problem be that the OVFL bit is always 1? 

Macar_0-1684838079344.png

 

0 Kudos
1,771 Views
Nhi_Nguyen
NXP Employee
NXP Employee

Hi Macar,

As you said that you had output signal from PWM. You ensure that interrupt configured correctly. But condition to raise interrupt is FLAG bit raised.

Nhi_Nguyen_0-1684901305420.png

This bit raised when input signal is exist. So, you checked has data in this signal? You can check this through register that configure Port is input for mode EMIOS23_IN and the path from PWM to ICU is not broken.

Nhi_Nguyen_6-1684903215077.png

 

Did you check pending interrupt? through this register

Nhi_Nguyen_1-1684902485966.png

When I looked at your register, bit 20 of the register UC, it is 1.

Nhi_Nguyen_2-1684902613399.png

Nhi_Nguyen_3-1684902638398.png

but follow RM, this bit have to be 0.

Nhi_Nguyen_4-1684902672080.png

So, you also check the board that you're using to test.

About the bit OVFL, this bit raised for every time internal counter is overflow.

Nhi_Nguyen_5-1684902797402.png

It is one of parameters that used to calculate period of input signal and don't raise interrupt. So, it is not affect to your case.

Anyway, did you try to run example that attached in previous reply? and compare with your project. You can just use configuration in my project to replace in your project, to limit range of where the issue can come from.

Best regards,

Nhi

 

0 Kudos
1,766 Views
Macar
Contributor III

Hello, I activated IGF for the relevant ICU pin and the interrupt started to appear, In the sample project you sent, IGF is configured for the relevant ICU pin. but I could not fully understand why. Thank you very much for your help. 

Macar_0-1684906055573.png

 

0 Kudos