2020-03-03 01:55 PM
I was making a basic test for GPIO ports (reading switches and turning on LEDs). After configuring PORTB (all pins) as input with internal pull-up and external interrupts disabled, PB7 seems to be always in '0'. After opening IAR-EW debugger, PB_DDR, PB_CR1 and PB_CR2 registers have correct value (0x00, 0xFF, 0x00) but PB_IDR show (0x7F). This is, PORTB bit 7 is '0' (0111 1111).
I suspected internal pull-up is damaged (?) then configured PB7 as floating input and connected an external pull-up resistor (PB6:PB0 still as inputs with internal pull-up). I got same behavior. But when I connected an external PULL-DOWN resistor, then PB7 works great and switch connected to this pin produces changes of '1' and '0' (opened / closed).
Is really PB7 internal pull-up damaged or not working? (is this the same for all the STM8L152R8's) :sad_but_relieved_face:
Does exist any info about not using PB7 as input with internal pull-up? (I couldn't find it) :\
Whate am I doing wrong? (This behavior happens only with PB7 -and presumibly PG7-; rest of GPIO works all ok). :pensive_face:
Yes, I've already checked errata sheet, reference manual, datasheet and searched in the forums for any clue without success. :page_facing_up:
I'm using Windows 10, IAR-EW (code size limited license), STM8-NUCLEO and STM8L152R8 microcontroller.
Any help will be truly appreciated.
2020-03-13 09:57 AM
I would check the schematics. You probably have a consumer with a lower impedance connected to the pin if you read a zero on the port input when the pull-up is active.