AnsweredAssumed Answered

MPC5748G Devkit - how to send a HIGH to a GPIO pin

Question asked by Lukas Lukaski on Jul 10, 2020
Latest reply on Jul 13, 2020 by Petr Stancik

I am pretty new to this device and I struggle with understanding few things.

I would like to send a '1' (high) value to one of the pins. I can't get it done. Here is what I tried (with S32DS IDE).


1. Pin selection and intialisation:

 I want to use PA1 in J3 area. I clicked on the 'pin_mux:PinSettings' in the components area and used the GUI to pick GPIO 1 from SIUL2 module. I set it to PA[1] and to 'Output'. After 'generating processer expert code' my pin_mux.c got updated with an entry for that pin. It reads that    .pinPortIdx = 1u, and .gpioBase = PTA . Seems fine.

Next I entered this function in my main.c to initialise:

 PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);


2. Sending 'High' to a pin:

Just underneath the pin initialisation line I called this function:

PINS_DRV_WritePin(PTA, 1u, 1);



Unfortunatelly this doesn't work. I mean that I can't measure any voltage on the pin, and I can't find any register entries that change when I debug the code.


My questions are:

1. How does the MPC574G use the embedded registers to send a 'high' on a pin? In the LED example from the nxp website, a mask was used that set only one bit in the fourth byte of a register to '1', which turned the onboard LED on. Does it mean that only specific bits of a register get transfered to a pin?

2. How can i figure out what are the connections between embedded registers and pins that are set up in 'PinSettings' GUI.

3. What can i do to make my code work?


thanks in advance for your help.


Here is my main() from main.c :

int main(void)
  /* Write your local variable definition here */


  /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
  #ifdef PEX_RTOS_INIT
    PEX_RTOS_INIT();                   /* Initialization of the selected RTOS. Macro is defined by the RTOS component. */
  /*** End of Processor Expert internal initialization.                    ***/


  /* Initialze pins */
  PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);


  /* send 'high' to pin*/
  PINS_DRV_WritePin(PTA, 1u, 1);


  /*** Don't write any code pass this line, or it will be deleted during code generation. ***/
  /*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/
    PEX_RTOS_START();                  /* Startup of the selected RTOS. Macro is defined by the RTOS component. */
  /*** End of RTOS startup code.  ***/
  /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/
  for(;;) {
    if(exit_code != 0) {
  return exit_code;
  /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/
} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/