2018-05-18 02:05 AM
Hi, I would like to use the SWIM port of STM8L001J3 to control an LED.
Obviously the same port will also need to be used for debugging and programming.I ask if it is possible to connect the LED directly to the port or if is it better to use a MOS-N (2N7002) to avoid impedance problems?I attach the schematic of the solution with MOS-N.Thank you for your valuable feedback and suggestions
Sisto
#stm8l001j3-swimSolved! Go to Solution.
2018-05-19 04:22 AM
Probably a typo. 'C' is next to 'X' on the keyboard...
2018-05-19 11:48 GMT+03:00 Sisto Zànier <st-microelectronics@jiveon.com>:
STMicroelectronics Community
<https://community.st.com/?et=watches.email.thread>
Re: Simple remote control using STM8L001J3
reply from Sisto Zànier
<
MCUs* - View the full discussion
<https://community.st.com/0D70X000006SwexSAC
2018-05-18 02:29 PM
'
if it is possible to connect the LED directly to the port'yes.
'or if is it better to use a MOS-N (2N7002) to avoid impedance problems?'
yes.
depending on what LEDs you are trying to drive.
2018-05-18 10:56 PM
I strongly recommend you to use the SWIM pin for an input, and another pin for the led output.
SWIM pin can be used as an GPIO input directly (it even has the pull-up activated at reset time). If you want to use it as an output, you have to change it's direction in the DDR register. This will make it unusable for programming/debugging. ST recommends you should do that 5 seconds
:(
after reset! Take great care!If you use it as an input you won't be able to use it for debugging when you press that button of course, but at least programming the chip is safe (also when you don't press that button).
About the led, just connect it directly. The 1K resistor sets the current way lower than the chip can handle. The 10K pull down is not necessary (unless you have some other reasons). The led won't light at power on reset because the ports are high-Z.
I have a golden rule about the SWIM pin: Don't use it at all, or just use it with the default configuration: input with pull-up (at reset time this pin has the pull-up resistor already activated, the other port pins are high-Z).
Success!
2018-05-19 03:48 AM
Thanks for Your useful suggestion.
I will swap the LED command to PC2 I/O, removing MOS-N, R13 and connect P4 button on PA0/SWIM.But, since I must use this input in Ext Interrupt mode, I've noticed that this pin have a ''C'' label on this function (see Table 3 image).What's the meaning of ''C''? In Table2 of the D.S., I not found any explanation for this and then I'm not shure that I can use the I/O in ext interrupt mode.What do you think about?2018-05-19 04:22 AM
Probably a typo. 'C' is next to 'X' on the keyboard...
2018-05-19 11:48 GMT+03:00 Sisto Zànier <st-microelectronics@jiveon.com>:
STMicroelectronics Community
<https://community.st.com/?et=watches.email.thread>
Re: Simple remote control using STM8L001J3
reply from Sisto Zànier
<
MCUs* - View the full discussion
<https://community.st.com/0D70X000006SwexSAC
2018-05-19 05:43 AM
May Be... I hope.
In any case, I will test using STM8L Discovery board removing SB16 to exclude &sharpReset and to simulate STM8L001J3M3 hardware condition.