Regarding setup digital pin

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User16910
Level 1
Level 1
I am using tricore tc233 microcontroller for project purpose . I try to configure P40 pin as digital pin but by default it use as analog pin

The configuration I made is below, (p40.0 to p40.3)
portswitch->IOCR0.U = 0x08080808; // pull up input
portswitch->PDISC.U = 0X00000FF0;


when I try to flash this code , debugger moving to trap further not proceeding. Also Cannot able to write into this PDISC register,

Help us to guide how to over come this issue, and how to make analog to digital input of port 40.

Please share if any pseudocode or sample code to make analog input to digital input.
0 Likes
1 Reply
cwunder
Employee
Employee
5 likes given 50 likes received 50 solutions authored
When writing to the special function registers you need to check the access rights. The PDISC register has the following access rights SV, E, P. Which means you must be in supervisor mode, is CPU EndInit protected and has master access protection.

If you are using the software frameworks you can use the defined functions:

   
uint16_t cpuWdtPassword = IfxScuWdt_getCpuWatchdogPassword();


IfxScuWdt_clearCpuEndinit(cpuWdtPassword);
portswitch->PDISC.U = 0X00000FF0;
IfxScuWdt_setCpuEndinit(cpuWdtPassword);
0 Likes