Skip to main content
dwarnke
Associate II
July 15, 2014
Solved

IO Function Switching

  • July 15, 2014
  • 1 reply
  • 876 views
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 topic has been closed for replies.
    Best answer by Erwan YVIN
    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

    1 reply

    Erwan YVIN
    Erwan YVINBest answer
    ST Employee
    July 17, 2014
    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