I am trying to spy the actual value (setting) of some registers of some peripherals
this generally works , but I have a problem with USART2->CR1 : it always says value is "0" , but this is not possible , as USART2 is currently working
is there an other way to designate USART2->CR1 , in ordre to read the right value ?
tis is the code ; USART2 is outputed to a logical analyser , so I see it works ; MCU is generic STM32G431CBUx
Code: Select all
HardwareSerial Serial2(PA3, PA2); /// USART2
uint64_t millis_duration = 100, millis_begin;
void setup() {
Serial.begin(115200); // USB to monitor
delay(3000);
Serial2.begin(250000); // PA2 USART2 Tx
}
void loop() {
if (millis() - millis_begin > millis_duration) { // debug uart
millis_begin += millis_duration;
Serial.println(USART2->CR1, BIN); /// debug to monitor
Serial2.write(USART2->CR1); /// confirms USART2 is working , confirms read CR1 value is false
}
}