Jump to content
  • 0

MCC152 - DIO on startup set to all outputs on. Can this be modified?


Dloman

Question

11 answers to this question

Recommended Posts

  • 0

The digital IO power up as inputs that are logic high. Use the programmable pull resistors to pull them low. Use the mcc152_dio_config_write_bit or mcc152_dio_config_write_port to configure them for output, output type, and pull-up direction.

https://mccdaq.github.io/daqhats/c.html#c.mcc152_dio_config_write_bit

https://mccdaq.github.io/daqhats/c.html#c.mcc152_dio_output_write_port

image.png

Link to comment
Share on other sites

  • 0

The board is programmed at the factory to be pull-up. You can override this using the functions I mentioned, and the new configuration is saved to the board. Modify the digital_output_write_port example to include the mcc152_dio_config_write_port to change the pull-up direction. Run the program and after repower the RPI and check the lines - they should be low.

Link to comment
Share on other sites

  • 0

I tried this and it still comes up as all on...

Confirmed the port was off before cycling power.

from daqhats import hat_list, HatIDs, mcc128, mcc152
from daqhats import DIOConfigItem,AnalogInputMode,AnalogInputRange,OptionFlags

a = mcc152(0)
values=0
a.dio_output_write_port(values)
a.dio_config_write_port(DIOConfigItem.DIRECTION,0)
a.dio_config_write_port(DIOConfigItem.PULL_CONFIG,0)
a.dio_config_write_port(DIOConfigItem.PULL_ENABLE,1)

Link to comment
Share on other sites

  • 0

I've asked engineering for more information about the pull-up resistor configuration. My test set the port to input, pull down, push-pull, and pull enabled fail because it still returns 0xFF as the port value. When I have more information I will update this thread.

Link to comment
Share on other sites

  • 0

I got the pull-downs to work for inputs using the commands below. However, when the board goes through a power cycle the pull-downs get disabled. When the port was set to output, the lines remained high when the pull-downs were enabled. Because the pull resistors don't work as expected, I recommend adding an external inverter circuit so that when the board powers up with the lines high, your circuit will see lows.

    mcc152_dio_config_write_port(address, DIO_OUTPUT_TYPE, 0x00); //push pull
    mcc152_dio_config_write_port(address, DIO_PULL_CONFIG, 0xFF); // pull down
    mcc152_dio_config_write_port(address, DIO_PULL_ENABLE, 0xFF); //enable
    mcc152_dio_config_write_port(address, DIO_DIRECTION, 0xFF); // set to input
 

Link to comment
Share on other sites

  • 0

Any chance the firmware will get updated to retain these settings?

Yeah, an inverter works, but this is not what the McDaq requires.  Hardware setup was made for that.  McDaq was out of stock, so went with the Pi Hat approach.  Didn't realize it would work differently.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...