GPIO control quickly for S32K341

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

GPIO control quickly for S32K341

435 Views
Masaki_Mori
Contributor II

I'm using the S32DS3.4 sample "Port_Example_S32K342." I want to measure multiple SPI-specification sensors at the same time, so I want to control GPIO at high speed. I controlled the port output using an inline assembler, but the frequency was 2MHz. Please let me know if there are any conditions for faster control.

while (count++ < 4)
{
/* Get input level of channels */

__asm__ __volatile__ ("ldr r0, =0x40291302");
__asm__ __volatile__ ("ldr r1, =0x1");
__asm__ __volatile__ ("strb r1, [r0, #0]");
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("ldr r1, =0x0");
__asm__ __volatile__ ("strb r1, [r0, #0]");
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("ldr r1, =0x1");
__asm__ __volatile__ ("strb r1, [r0, #0]");
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("nop");
__asm__ __volatile__ ("ldr r1, =0x0");
__asm__ __volatile__ ("strb r1, [r0, #0]");

TestDelay(1000000);
}

0 Kudos
Reply
2 Replies

398 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello @Masaki_Mori,

It is not recommended to use the core for precise timing.

The execution time depends on many factors like cache hit/miss, crossbar switch arbitration, etc. and ARM does not even specify instruction cycles for CM7.

Use a HW module e.g. FlexIO.

 

Regards,

Daniel

 

 

0 Kudos
Reply

395 Views
Masaki_Mori
Contributor II

Hello Daniel-san

Your information is very helpful. I checked "Siul2_Port_Ip_Example_S32K342" and it was 140kHz. This matter is closed.

Thanks,  Masaki

 

0 Kudos
Reply