cancel
Showing results for 
Search instead for 
Did you mean: 

IO Function Switching

dwarnke
Associate II
Posted on July 15, 2014 at 21:38

I have a project that requires an IO pin to switch between High Z (Tri-State) and High. On a previous 8 bit micro the high z condition was satisfied by setting the port to an input and the high was satisfied by making the port and output and driving it high.

I am using the Hal drivers for non-OS and am strugglinig to find the commands to do this. I tried doing the following with o results:

// Set Charge to Output and Set High

palSetPadMode(PORT_B, CHARGE, PAL_MODE_OUTPUT_PUSHPULL);

palSetPad(PORT_B, CHARGE);

        

// Delay 5us

//osalThreadSleepMicroseconds(CHARGE_WAIT);

osalThreadSleepMicroseconds(50000);

        

// Set Charge to Input and set to high z

palSetPadMode(PORT_B, CHARGE, PAL_MODE_INPUT);

I played with different delay lengths thinking the scope missed it.

Please let me know if you have any ideas.

Doug

#spc56
This discussion has been locked for participation. If you have a question, please start a new topic in order to ask your question
1 ACCEPTED SOLUTION

Accepted Solutions
Erwan YVIN
ST Employee
Posted on July 17, 2014 at 17:54

Hello Doug ,

Sorry , at the current time, pal_lld_setpadmode is not  implemented (cf pal_lld.h)

/**

 * @brief   Pad mode setup.

 * @details This function programs a pad with the specified mode.

 * @note    The @ref PAL provides a default software implementation of this

 *          functionality, implement this function if can optimize it by using

 *          special hardware functionalities or special coding.

 * @note    Programming an unknown or unsupported mode is silently ignored.

 *

 * @param[in] port      port identifier

 * @param[in] pad       pad number within the port

 * @param[in] mode      pad mode

 *

 * @notapi

 */

#define pal_lld_setpadmode(port, pad, mode)

we need to write the PCR register in this case.

it is a change request in PAL LLD side.

Best Regards

                     Erwan

View solution in original post

1 REPLY 1
Erwan YVIN
ST Employee
Posted on July 17, 2014 at 17:54

Hello Doug ,

Sorry , at the current time, pal_lld_setpadmode is not  implemented (cf pal_lld.h)

/**

 * @brief   Pad mode setup.

 * @details This function programs a pad with the specified mode.

 * @note    The @ref PAL provides a default software implementation of this

 *          functionality, implement this function if can optimize it by using

 *          special hardware functionalities or special coding.

 * @note    Programming an unknown or unsupported mode is silently ignored.

 *

 * @param[in] port      port identifier

 * @param[in] pad       pad number within the port

 * @param[in] mode      pad mode

 *

 * @notapi

 */

#define pal_lld_setpadmode(port, pad, mode)

we need to write the PCR register in this case.

it is a change request in PAL LLD side.

Best Regards

                     Erwan