Output Pins used for Triggering External Components



  • Hi all.

    I am looking for triggering an external circuit (it's a watchdog, but never mind) through LoPy4. The trigger requests a falling/rising edge, so I am using one of the Pins configured as OUTPUT and change accordingly its value from 0 to 1 or inversely. The code to accomplish this is very simple:

    def set_pin_high(pin):
    	""" Sets a PIN to HIGH value temporarily"""
    	tpin=Pin(pin,Pin.OUT)
    	tpin.value(0)
    	utime.sleep_ms(_SLEEP_TIMEOUT_MSEC)
    	tpin.value(1)
    	utime.sleep_ms(_SLEEP_TIMEOUT_MSEC)
    	print('Pin value: {}'.format(tpin.value()))
    	tpin.value(0)
    	utime.sleep_ms(_SLEEP_TIMEOUT_MSEC)
    	print('Pin value: {}'.format(tpin.value()))
    	utime.sleep_ms(_SLEEP_TIMEOUT_MSEC)
    

    So, my question has to do with the proper selection of the LoPy4 pin. According to the pinout diagram in https://docs.pycom.io/gitbook/assets/lopy4-pinout.png, I could use any GPIO except for the ones which are assigned for internal purposes, i.e. P0/P1 (UART) ,P3/P4 (UART), P5-P7 (LORA), P12 (WiFi/Boot), P13-P18 (Only input). Am I correct?

    Now, I've tried P11 and it works as expected. However, P23 seems to enter a HIGH state at various occasions. For example, when the input voltage is below the operating threshold of 3.5V (in particular close to 3V) then it stalls at a HIGH state, measured at 1.2-2 V, and can't recover from that. I am suspecting that P23 is also used for other purposes? Same behavior is observed at various LoPys and GPys.

    So, any suggestions on the proper pins to use for OUTPUT?
    Many thanks!

    P.S. Why having a constant HIGH output state bothers me? The objective is to send a HIGH trigger to my watchdog in order to reset it using a pin from the pycom board, every time the board operates without an error. When the watchdog hasn't received a trigger for some time it sends a reset signal to the pycom board. But, using P23 I may get caught in a situation with constant HIGH output sent to the watchdog, which makes the watchdog useless...



  • @agotsis P23 is used for the SD Clock signal.



  • @robert-hh said in Output Pins used for Triggering External Components:

    P23 as well as P4 and P8 are used for the SD card,

    Many thanks @robert-hh for the clarifications!
    Some extra comments:

    • I indeed intend to use UART1, that's why i excluded P3-P4. For reassigning UART1 to P13-P18 you are referring only to the Rx path, right (since these are all input pins)? And similarly, can I use any of the output pins to redirect the Tx path?
    • I actually don't use an SD card now (i work with the module directly, not through an expansion board), but I guess this has to do with that. However, in the schematic I don't see any indication like sdDATAx on P23, but only for P3,P4,P8,P10. Am I missing something?

    Anyway, I go on with the proposed pins, which are more than ok for me,
    Thanks,
    A./



  • @agotsis P23 as well as P4 and P8 are used for the SD card, as long as you use it. You can use P9 - P11 and P19 - P22. The use of P3 and P4 are just the default assignments for UART1. If you do not use UART1, you can use P3 and P4. You can also assign UART1 to other pins, like it's RX to one to the pins P13 - P18.


Log in to reply
 

Pycom on Twitter