cancel
Showing results for 
Search instead for 
Did you mean: 

Simple wiring of STM8S003F3P6TR for one input and one output

lyoy
Associate III

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!

1 ACCEPTED SOLUTION

Accepted Solutions

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

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

5 REPLIES 5
Peter BENSCH
ST Employee

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

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

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

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

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
lyoy
Associate III

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?

You could use an external resistor or simply set the push-pull and drive them low.

Regards

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.