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.

BQ40Z80: How can I set Pin16 (PDSG/GPIO) as a GPIO port? At the same time, Pin16 remains high until shutdown.

Part Number: BQ40Z80
Other Parts Discussed in Thread: BQSTUDIO

TI experts,

    1. How can I set Pin16 (PDSG/GPIO) as a GPIO port? At the same time, Pin16 remains high until shutdown.

    2. Is the setting in the picture below correct?


    3. Does this part of FlagMapSetUp0...7 need to be set?

    

    

   

  

    

  • Hi jmyang,

    1.To configure Pin 16 as a GPIO you only need to set the Pin Settings[MFP16_SEL1][MFP16_SEL0] = 1,0 which it looks like you have done 

    2. For pin 16 configuration your first picture looks correct. The GPIO Sealed Access Config register determines whether the GPIOs can be controlled or read only when the gauge is sealed. This depends on your application but if you want the GPIO to be controlled and read when it is sealed then yes, this is correct.

    3. FlagMapSetUp is only needed if you plan to use the GPIO as an interrupt. If you plan to use it as an interrupt, I recommend you look at the examples in section 13.2 GPIO Interrupt in the Technical Reference Manual to see how to configure this register. If you are not using it as an interrupt, please use the GPIORead() and GPIOWrite() to read/write to pin 16.

    Best,

    Jessica 

  • Hi Jessica,

    1. I want to use pin16 as GPIO and output high level. Is it necessary for the MCU to send the command GPIOWrite() (0x49)?


    2. Or can I do it in other ways? My BMS does not have an MCU, how can I achieve it?


    3. Can commands be sent via advanced communication SMB? Can it be saved in the production file Srec?

  • Hi jmyang,

    You can use the advanced communication in BQStudio to send the command. 

    Best,

    Jessica

  • Hi Jessica,

    Does that mean that every time I want to set PIN16 high, I need to send a command? Can I save the instructions for this setting in the Srec file?

  • Hi jmyang,

    Yes, you will need to send the command every time you want to set the pin high. It will get reset every time the device wakes up. You cannot save the setting to the srec file because the register is not stored in data flash.

    Best,

    Jessica