Peripheral initialized or not?

cancel
Showing results for 
Search instead for 
Did you mean: 

Peripheral initialized or not?

249 Views
raghurajappa
Contributor IV

I am working with the MPC5745R SDK (provided by NXP). While using drivers, for example GPIO, if I want to write a value on a pin, I would use the function 'WritePin'. But as an application developer, when I use this function, how can I be sure the specified pin has already been configured and initialised? 

The question applies to other peripherals too. I would like to know if a peripheral is initialised prior to using the peripheral. There exists workarounds like using flags to keep track of the status of a pin or transceiver. But that means I need to write and maintain a lot of code. I would like to know if there exists registers that already keep track of this data, for this microcontroller. 

I was looking through the manual but could not find anything in particular. Could you please point me to some registers that track the state of the peripheral (whether initialised, whether output/input) ? I am currently looking through GPIO and CAN. But I am sure the question would easily apply to ADC or SPI or UART too. 

1 Reply

175 Views
petervlna
NXP Employee
NXP Employee

Hi,

You have 2 possibilities:

1. You can trust your code that micro is configured as it should be. The code flash content verification is done via mechanisms like array integrity checks. This will ensure that your code in memory is not changed.

Additionally there is Build in self test which tests logic and memory of microcontroller during reset or during runtime.

2. If you need additional checks you can always implement in SW register content monitoring. But the first scenario is enough for ASIL-D applications.

for details refer to reference manual Chapter 75 Functional Safety

regards,

Peter