May somebody share on how to use it?
I need to process a serial frame,in interrupt on RX .
So if you want to call your own function as well as the character going into the ring buffer, you would need to modify the code in cores\maple\libmaple\usart_f1
e.g.
void __irq_usart1(void) {
usart_irq(&usart1_rb, USART1_BASE);
}
So this function is the interrupt handler? It is fired automatically?
I presume it is fired straight away, but the best option is for you to write some code and do some research, or to read the master programming manual for the F103
Serial and Serial2 are compiling.
I want to use USART3 because it is 5V tolerant.USAR2 is not,and I keep USART1 for debugging.
Or maybe Serial2 it is USART3 ?Confusing.Yes I see that in boards.cpp for generic,
Serial and Serial2 are compiling.
I want to use USART3 because it is 5V tolerant.USAR2 is not,and I keep USART1 for debugging.
Or maybe Serial2 it is USART3 ?Confusing.Yes I see that in boards.cpp for generic,
I don’T know how to proceed.I can replace __irq_usart3() in usart_f1.c but it seems too complicated and too personalized with declaring specific variables used only inside my sketch.I need to process data in the interrupt and have more control.
How can I use the original STM32 USART interrupt handlers?.
I read reference manual but did not find what I’m looking for.On avr it is simple you know the name of the vector and you call it inside the sketch.I want to do the same.
I don’T know how to proceed.
<…>
I need to insert something similar on my sketch.I need my handle override default handler from maple.
uint16_t x;
uint16_t index;
#define BUFFER_SIZE
void USART_3 interrupt handler() {//?????
if((USART3_BASE->SR &0x0F)==0) // Check overrun, noise error,framing ,parity error
{
if(index==0){
if((USART3_BASE->DR&0xff)==x){
index++;
start a timer for 5ooous;
interrupt on timer output compare;
}
}
else{
buffer[(index++)-1]=USART3_BASE->DR&0xff;
if(index>BUFFER_SIZE){
disable timer interrrupt;
index=0;
}
}
}
else
index=0;
}
I need to insert something similar on my sketch.I need my handle override default handler from maple.
<…>
declaring extern in usartf1.c file ,….and calling it in my sketch but I received error “expected identifier or ‘(‘ before string constant extern “c” void.….”
extern "C" void __irq_usart3(void);
<…>
I want to be able to use my handler or maple handler in my sketch.
for your effort.
I solved the problem It was so simple.
And it think the some modification can be made permanent in maple core for all versions.
Now I can play whatever I want in my sketch.I already test it and working ok.
mbolivar
“In general, IRQ handlers need C linkage. Within a C++ file, this means you either put them within an extern “C” block, or you declare them extern “C” with
extern “C” void __irq_whatever(void) { … }
Within a C file, they’ll have C linkage already, so the extern linkage specifier is unnecessary.
Regarding how to release code which overrides IRQ handlers as a library, this is currently a pain, since you have to get your users to comment out the handlers in the copy of libmaple that comes with the IDE. That’s obviously not ideal, so in the next version, we’ll be making the libmaple IRQ handlers weak, so you can override them just by declaring your own.”
He never did that.So how about now?
EDIT: I have answered my own question by trying a sample sketch and the answer is no, the weak attribute did not get implemented.
What likely problems would it cause to the core to add the __weak attribute to the usart_f1.c interrupt definitions and would it allow a user to implement there own service routines using something like below in there code.
extern "C" void __irq_usart1(void)
{
// etc.
}
Now they are included in multiprotocol.And working excellent.
If you want to see more ,is here.
The serial handlers are in multiprotocol.ino/telemetry.ino
https://github.com/pascallanger/DIY-Mul … rduino-ide
https://github.com/pascallanger/DIY-Mul … -TX-Module


