cancel
Showing results for 
Search instead for 
Did you mean: 

Translating incoming data from PA10 (USART1 Rx) to PB4 (JTRST) with erased FLASH or under reset in STM32G473

Nabekaite
Associate II

I have RS-485 transceiver connected to USART1 (PA9 + PA10) and relay connected to PB4. If MCU have erased FLASH or RST-pin connected to GND all incoming data to pin PA10 (Rx) for RS-485 line translated to pin PB4 in inversion (0 on PA10 => 1 on PB4, and 1 on PA10 => 0 on PB4). Why PB4 set as output and how it connected to USART1 Rx? And why is the output level inverted relative to the input?)

1 ACCEPTED SOLUTION

Accepted Solutions

The UCPD dead-battery behaviour is independent of the rest of UCPD. Think about using this feature: it is aimed at having the pulldown in place exactly when the mcu is not working, to indicate to the charger that there's not enough charge left in the battery to run the mcu.

The behaviour of this feature is governed runtime by PWR_CR3.UCPD1_DBDIS, by reset enabled.

JW

PS. This is a surprising feature which got into your way. Who would possibly like this? :D

View solution in original post

8 REPLIES 8

Try this on a "known good" board such as Nucleo or Disco.

JW

From RM0440:

The NJTRST (PB4) pin has also UCPD_CC2 functionality which implements internal UCPD

pull-down resistor (5.1 KΩ) which is controlled by voltage on UCPD_DBCC2 pin (PA10). to

disable the pull-down on the NJTRST (PB4) pin the UCPD_DBCC2 pin (PA10) must be held

at low level voltage (see Section 45.4.6: UCPD Type-C pull-ups (Rp) and pull-downs (Rd)).

JW

Nabekaite
Associate II

But how UCPD works with erased FLASH or grounded RST? By default UCPD is disabled (UCPD_CFGR1 Reset value: 0x0000 0000).

The "dead battery" pulldown resistor works directly in hardware, i.e. even if the mcu is in reset, that's why it can be disabled by pulling down PA10.

Yes I know you don't like it but that's how it works.

JW

Nabekaite
Associate II

You want to say that RM is lying about the turned off UCPD at startup?

"Yes I know you don't like it" - it's not whether I like it or not. I'm just trying to figure out how it works to avoid similar moments in the future.

The UCPD dead-battery behaviour is independent of the rest of UCPD. Think about using this feature: it is aimed at having the pulldown in place exactly when the mcu is not working, to indicate to the charger that there's not enough charge left in the battery to run the mcu.

The behaviour of this feature is governed runtime by PWR_CR3.UCPD1_DBDIS, by reset enabled.

JW

PS. This is a surprising feature which got into your way. Who would possibly like this? :D

Nabekaite
Associate II

This MCU is to hard for me. Where is my arduino...

It is really surprising feature for me.

Thanks bro :)