Hi,
I have to read some data from UART of my flex board: using the EE_UART_Receive I was able to read all the data correctly. But unfortunatly I have to use interrupt instead of polling. I found a function in eeuart.h header, EE_UART1_SetCallback: is it for reading data with interrupt? If so, can someone explain me how to use it? I can\'t understand how it works...
Thanks to all!
/Alberto
UART interrupt mode
Moderator: paolo.gai
Re:UART interrupt mode
I guess you refer to the files into the pic30_serial example...
The general idea of the callback is the following:
- the driver provides all the internal details about handling the serial line.
- but when a data is transmitted or received, only the application knows what to do with that data.
- for that reason, the driver stores in a pointer to function an application callback, which is called upon reception or send of a byte on the serial port. The contect in which the callback is called is an ISR2, so that the application can call RTOS primitives, for example to activate a task or set an event.
but reading the code, It seems they only support Polling; also the callback are not implemented.
If you modify it adding interrupts, please send the result back to nino, so taht we can integrate it into the main build...
Ciao,
PJ
The general idea of the callback is the following:
- the driver provides all the internal details about handling the serial line.
- but when a data is transmitted or received, only the application knows what to do with that data.
- for that reason, the driver stores in a pointer to function an application callback, which is called upon reception or send of a byte on the serial port. The contect in which the callback is called is an ISR2, so that the application can call RTOS primitives, for example to activate a task or set an event.
but reading the code, It seems they only support Polling; also the callback are not implemented.
If you modify it adding interrupts, please send the result back to nino, so taht we can integrate it into the main build...
Ciao,
PJ
Re:UART interrupt mode
It started as a polling demo, then it was extended. It was not finished yet when the kernel was released, then we had the idea of putting devices support in the board level so the demo was not ended. We hope to have the new support in the next release of the kernel.
Re:UART interrupt mode
Hi,
I was reading this post. I\'d like to use UART in interrupt mode too. Could you explain better how to set-up the peripheral in \"Interrupt mode\" ?
Thank you,
Pasquale.
I was reading this post. I\'d like to use UART in interrupt mode too. Could you explain better how to set-up the peripheral in \"Interrupt mode\" ?
Thank you,
Pasquale.
Re:UART interrupt mode
The peripheral settings in the described demo are fully working and you can look at them as an example.
It is the I/O management the is still an ongoing part.
It is the I/O management the is still an ongoing part.
Re:UART interrupt mode
Thank you. I\'d like to know if in the Erika code I can use the normal microchip code. For example to initialize a peripheral and for example the classic method to use interrupt which is :
void __attribute__((__interrupt__)) _PERIPHERALInterrupt( void ){
...code
}
I mean if I initialize a peripheral with interrupt it\'s gonna be the above code that will be called or the Erika catch the interrupt and manage it in a different way ?
Thank you in advance,
Pasquale.
void __attribute__((__interrupt__)) _PERIPHERALInterrupt( void ){
...code
}
I mean if I initialize a peripheral with interrupt it\'s gonna be the above code that will be called or the Erika catch the interrupt and manage it in a different way ?
Thank you in advance,
Pasquale.
Re:UART interrupt mode
The answer is yes.
Erika shall not catch any kind of interrupts at all, unless you want erika to do it.
Be aware that with this solution you will not use properly the erika kernel, since the erika interrupt handling has been done to have coherency in the task scheduling mechanism.
To tell the kernel that you want to use an interrupt service routine you should use the ISR2() or ISR1(), look at the erika refman for further details.
The syntax for the same example you mentioned before is:
Erika shall not catch any kind of interrupts at all, unless you want erika to do it.
Be aware that with this solution you will not use properly the erika kernel, since the erika interrupt handling has been done to have coherency in the task scheduling mechanism.
To tell the kernel that you want to use an interrupt service routine you should use the ISR2() or ISR1(), look at the erika refman for further details.
The syntax for the same example you mentioned before is:
Code: Select all
ISR2(_PERIPHERALInterrupt)
{
/* Interrupt body! */
code .....
}
Re:UART interrupt mode
Exact. ERIKA does not touch any interrupt unless you want to. All the Microchip code can be used with the Kernel. in that case, the ISR will be called \"ISR Type 1\", whereas \"ISR Type 2\" are the ISR handled by the kernel.
The EE Manuals each contain a table with the list of functions and in which context they they can be called.
PJ
The EE Manuals each contain a table with the list of functions and in which context they they can be called.
PJ