S32K312 PTE13, PTE8 Toggle

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

S32K312 PTE13, PTE8 Toggle

95 次查看
Tasker
Contributor I

Hi 

I have a query regarding toggling  pins. 

To toggle PTE13 and PTE8 pins in S32K312 below code was used, but the pins are not toggling.

The register MSCR and GPDO is configured as 0x00200000 and 0x0 - 0x1 respectively.

Since the Pins are not toggling, is there any other registers to be configured.

Sharing the sample c code the below,

Code START ---->>

...

#define WRITE32BREGTOPIN( address, value) (*(volatile uint32*) (address)) = value
#define WRITE8BREGTOPIN( address, value) (*(volatile uint8*) (address)) = value

uint8 i;

..

WRITE32BREGTOPIN(0x40290474,0x00200000);  // MSCR of PTE13
WRITE32BREGTOPIN(0x40290460,0x00200000); // MSCR of PTE8
 for(i=0;i<100;i++);
 for(i=0;i<10;i++)
 {
 WRITE8BREGTOPIN(0x4029138E,0x0); // GPDO of PTE13
 WRITE8BREGTOPIN(0x4029138B,0x0); // GPDO of PTE8
 for(i=0;i<100;i++);
 i++;
 }

WRITE8BREGTOPIN(0x4029138E,0x1); // GPDO of PTE13
 WRITE8BREGTOPIN(0x4029138B,0x1); // GPDO of PTE8

<<----- Code ENDS

 

Thank you

0 项奖励
2 回复数

64 次查看
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi

Please download S32K3xx Pins and Clocks with RTD - Training (06_S32K3XX_PINS_AND_CLOCKS_WITH_RTD_TRAINING).

AGENDA SIUL2 06_S32K3XX_PINS_AND_CLOCKS_WITH_RTD_TRAINING.png

 

 

 

 

 

 

SIUL2_PORT EXAMPLE CODE.png


Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" 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.
-------------------------------------------------------------------------------

0 项奖励

72 次查看
dylan_cristiani
Contributor II

Do you se that the pins are always on? your code is a bit strange because when you enter the second for (i<10) loop, you toggle the leds off, then you perform another delay for to 100 with the same 'i' index then you add +1 to the index; the the inner for, that ends when i>= 10, ends immediatly because i=101 so you break and switch on the leds quite 'immediatly'; in general i'ts not a good programming choice to change the index's value inside its for statement, due to side effects like this one; try to make a basic delay using another index variable (for instance write a simple function to be called); and more: a for cycle from 0 to 99 is probably a little bit short to notice some 'delay effect'

0 项奖励