2022-03-02 09:26 PM
Greetings
I'm using an STM8S003F3 TSSOP20 (my first STMicro) for a simple project with one input (low frequency PWM) and one output (high frequency PWM). I seek to keep it as simple as possible. Since I'm not familiar with STMicro MCU's, I would like to confirm the wiring of this:
100nF between NRST and VSS
1uF between VCAP and VSS
1uF and 100nF in parallell between VDD and VSS
+5V to VDD
0V to VSS
VDD, VSS, NRST and SWIM connected to ICSP plug.
PWM input on PD2
PWM output on PD3
All other pins connected together, with one configured as output, driven to 0V
Thanks in advance for any helpful advice!
Solved! Go to Solution.
2022-03-03 01:23 AM
Yes, that could be somewhat misunderstood. If you look at the RM0016, section 11 (GPIO), you will also find a switchable internal pull-up resistor, so no external resistor is required. You could drive unused pins to a fixed value (0 or 1), but it is recommended to set the unused pins to input with pull-up without interrupt (see RM0016, table 21).
Regards
/Peter
2022-03-03 12:01 AM
Welcome, @Øyvind Lyse, to the community!
Essentially, you can leave the pin assignment as you've made it - except for the last sentence: you should definitely not just connect all unused pins together, but simply leave them open.
Regards
/Peter
2022-03-03 01:08 AM
Hi Peter
Thanks for your reply.
This is from the manual:
All unused pins must be kept at a fixed voltage: using the output mode of the I/O for example or an external pull-up or pull-down resistor.
It seems I misunderstood the first part of that sentence. If I don't want to use PU or PD resistors, and instead do as you say, should I then configure each unused pin individually as outputs and drive them low?
Kind regards,
lyoy
2022-03-03 01:23 AM
Yes, that could be somewhat misunderstood. If you look at the RM0016, section 11 (GPIO), you will also find a switchable internal pull-up resistor, so no external resistor is required. You could drive unused pins to a fixed value (0 or 1), but it is recommended to set the unused pins to input with pull-up without interrupt (see RM0016, table 21).
Regards
/Peter
2022-03-03 01:52 AM
OK, so RM0016 says unused pins must be configured as one of the following:
• connected to VDD or VSS by external pull-up or pull-down resistor and kept as input
floating (reset state),
• configured as input with internal pull-up/down resistor,
• configured as output push-pull low.
Port B4 and B5 can't be configured as input with internal pull-up, nor as output with push-pull low.
Does this mean I have to use external resistors for these?
2022-03-03 02:03 AM
You could use an external resistor or simply set the push-pull and drive them low.
Regards
/Peter