Author Topic: STM8L151  (Read 1115 times)

0 Members and 1 Guest are viewing this topic.

Offline graphtronicsTopic starter

  • Contributor
  • Posts: 10
  • Country: us
STM8L151
« on: November 19, 2024, 02:27:40 am »
Hello Forum  :popcorn:

Hope to find some help for the display and ADC connection.

MCU: STM8L151 XYZ 48 pins

DISPLAY: LED
a) Is it correct to assume that the GPIO voltage is either 3.3 V or 5 V? (since it considers them as 5 V tolerant). |O
b) Then, select resistor depending on the LED Vd and intended I?
c) Is the GPIO voltage suitable for common anode/cathode?

ADC
1) is there a dedicated pin (maybe 24 PF0 ) or can any GPIO be used? :scared:

Thanks  :clap:
 

Offline Postal2

  • Frequent Contributor
  • **
  • !
  • Posts: 791
  • Country: ru
Re: STM8L151
« Reply #1 on: November 19, 2024, 04:02:00 am »
Let's start with the 2nd question. It is impossible to determine the resistor for the LED, because different voltages drop on them, from ~1.2 to ~2.5 volts, you must measure this first. From this we get the answer to the first question, if it concerns LEDs powered by 5 volts. 4 pins have tolerance to 5 volts, 2 of them are I2C, the rest are not tolerant. If we occupy PF0, then the only one output DAC_OUT will be occupied, and we would like to have it. Therefore, it is better to work out the display first, and use what is left for the ADC.
 
The following users thanked this post: graphtronics

Offline Chicane

  • Contributor
  • Posts: 25
  • Country: us
Re: STM8L151
« Reply #2 on: November 21, 2024, 07:34:00 am »
Hello Forum  :popcorn:

Hope to find some help for the display and ADC connection.

MCU: STM8L151 XYZ 48 pins

DISPLAY: LED
a) Is it correct to assume that the GPIO voltage is either 3.3 V or 5 V? (since it considers them as 5 V tolerant). |O
b) Then, select resistor depending on the LED Vd and intended I?
c) Is the GPIO voltage suitable for common anode/cathode?

ADC
1) is there a dedicated pin (maybe 24 PF0 ) or can any GPIO be used? :scared:

Thanks  :clap:


a). If the GPIOs are 5V tolerant on a 3.3V Vcc part, it means the load you're connecting to those GPIOs can pull them up to 5V. In other words, the outputs will sustain 5V at whatever current they are rated for.
In this case, the Anode of your LEDs can be powered from a 3.3V rail or 5V rail. Hook them up to whichever one has higher current capability. If your main power is 5V and you're using LDO to drop it to 3.3V only for the microcontroller, then power your LEDs from 5V through an appropriate resistor.
b). To calculate the resistors, you need to know the voltage they are powered by (3.3V or 5V in your case) and the voltage drop of the LED itself, found in the datasheet of the particular LEDs in your design. Alternatively, you can estimate the voltage drop by the color of your LEDs (red=1.7-2V, green=3.4V, blue=3.5-4V, white=4V). Finally, you need to know the current you need to supply to your LEDs to achieve the desired brightness. I would recommend to start with 5mA and stay under 10mA, for the safety of your MCU. Obviously, you need to find in the datasheet of your MCU the current its GPIOs are rated for first.
c). The GPIOs are not suitable to drive common A or K, unless the sum of the currents through all the LEDs doesn't exceed the GPIO's current rating. Just add an external transistor, mosfet or BJT. Otherwise you have to calculate your LED resistors for 2mA at most and your display will likely be fairly dimm. And that's in case you have a 20mA capable GPIOs on your MCU.
Search the Web for LED resistor calulator, I'm sure you'll find plenty.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf