Serial event not running

Post here first, or if you can't find a relevant section!
Post Reply
picclock
Posts: 20
Joined: Sat Aug 14, 2021 8:21 am

Serial event not running

Post by picclock »

I'm using ST Link V2 for programming and an ftdi serial adapter connected to PA9, PA10 on an stm32F401.
This works fine for serial print of data to the Arduino serial monitor.

However I cannot get it to input characters, as the serial event function is not called.

Using the example serial event program I have inserted the following line :
HardwareSerial Serial1(PA10, PA9); //change serial to Serial1

Then changed all the Serial to Serial1.

and renamed the serial event call :
void serialEvent1()

Clearly I am missing something - any help much appreciated.

Best Regards

picclock
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: Serial event not running

Post by fpiSTM »

Right.
Serial event are not enabled by default, it requires to properly enable it using -DENABLE_HWSERIALx

See https://github.com/stm32duino/wiki/wiki ... wareserial
picclock
Posts: 20
Joined: Sat Aug 14, 2021 8:21 am

Re: Serial event not running

Post by picclock »

@fpiSTM
Thanks for the link, much appreciated. It will take me more than a minute or two to get around that.

From a quick scan this looks like the simplest option :

Serial.setRx(PA10); // using pin name
Serial.setTx(PA9);
Serial.begin(9600);

Just checked it out and it works a charm.

Definitely worth a virtual beer :D .

Many Thanks

Best Regards

picclock
Post Reply

Return to “General discussion”