GPIO control quickly for S32K341

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

GPIO control quickly for S32K341

631 次查看
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 项奖励
回复
2 回复数

594 次查看
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 项奖励
回复

591 次查看
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 项奖励
回复