This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Hercules RM48L952ZWT GIO (totem pole / open drain)

Other Parts Discussed in Thread: HALCOGEN

According to HalCodeGen, setting up a totem pole configuration for GIOA/B would mean leaving the box unchecked, as shown here.

Notice the tool-tip says "enable open drain." Checking the box makes the graphical image of the drain look like an open drain on the top.

    /** - Port A open drain enable */
    gioPORTA->PDR  = (uint32)((uint32)0U << 0U)  /* Bit 0 */
                   | (uint32)((uint32)0U << 1U)  /* Bit 1 */
                   | (uint32)((uint32)0U << 2U)  /* Bit 2 */
                   | (uint32)((uint32)0U << 3U)  /* Bit 3 */
                   | (uint32)((uint32)0U << 4U)  /* Bit 4 */
                   | (uint32)((uint32)0U << 5U)  /* Bit 5 */
                   | (uint32)((uint32)0U << 6U)  /* Bit 6 */
                   | (uint32)((uint32)0U << 7U); /* Bit 7 */

The code above shows the resulting code.

Here is my requirement:

Set the outputs as totem-pole, not open drain, by writing 0xFF to the GIO Open Drain Register[A](GIOPDR[A] at 0xFFF7BC48).

My requirement appears to contradict HAL Code Generator. Am I right? Is the requirement wrong on the value or am I just not understanding something.

  • HI Sarah,

    To use the open drain you need to write '1' to the PDR register. So in HalcoGen you will need to check the PDR box. If you don't want to use open drain feature then you keep it unchecked. What you do is correct as the 0 is being written to the gioPORTA->PDR register. The comment in your EE is not correct.