[SOLVED] STM32G431 : reading the current value of USART2->CR1 (and display it , for arduino style debugging)
[EDIT] displaying the values of the registers works on STM32duino arduino console
Hi ,
I am in the arduino world ; for some more particular tasks , the existing API is not enough , so I have to write my own code and debug it
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 , because USART2 is currently working !
Quetion : is there an other way to designate USART2->CR1 , in ordre to read the right value ?
this is the code : USART2 is outputed to a logical analyser , so can I see it really works
MCU is generic STM32G431CBUx ; thanks !
CODE: SELECT ALL
HardwareSerial Serial2(PA3, PA2); // configure USART2 uint64_t millis_duration = 100, millis_begin; // configure a 100ms tick void setup() { Serial.begin(115200); // USB to monitor delay(3000); Serial2.begin(250000); // PA2 USART2 Tx , to logical analyser } void loop() { if (millis() - millis_begin > millis_duration) { // debug USART2 millis_begin += millis_duration; Serial.println(USART2->CR1, BIN); // debug to monitor , display is always "0" ? Serial2.write(USART2->CR1); // can see the signal with logical analyser , confirms USART2 is working , confirms read CR1 value is false } }
