- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I can program the UART with Hardware Interrupt, because the Rx_Interrupt pin is available in the UART component. I need help in programming I2C with interrupt, because the component does not have any hardware Interrupt pin. Please find the piece of ISR that I have written to get a byte on UART of Master and send it to the Slave by I2C:
CY_ISR(ISR_Rx_UART_Interrupt)
{
I2CM_I2CMasterSendStart(I2C_SLAVE_ADDR, 1u);
I2CM_I2CMasterWriteByte(UART_GetChar());
}
At the end, I want to configure UART and I2C with Software Interrupt. Any reference to the explanation of Hardware and Software interrupt will be highly appreciated.
Thanks in Advance.
Shaunak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is an AppNote regarding interrupts: www.cypress.com/
Also, have a look at the example projects: right click on the component in the component browser, 'find example projects'.
It would also help if you state what the problem is - are there compile errors, does the ISR not get triggered (or only once?), or are there other problems?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the "System Reference Guide" (Creator -> Help -> System Reference) you'll find a lot about interrupts. Additional information you may get from ARM when looking into the "Cortex M0 Devices Reference Manual".
Keep in mind, that some components (as UART, I2C, ADC ...) alredy use interrupts for their internal usage.
A quite easier way to handle what you want to is to fetch all the incoming UART bytes and store them into a circular buffer, then empty the buffer and send the bytes via I2C. This could be done more effective than transferring single bytes from within an interrupt handler. Also, the I2C overhead is reduced because there is no start/stop condition requred between sending multiple bytes.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hli and bob, thank you very much for your inputs. I am already done with the UART receive interrupt, I2C-Write-from-Master-to-Slave interrupt. Now I need help to generate an interrupt from master I2C to read a particular data from slave I2C. Please guide for that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you tell us, why you want to do that interrupt-driven by a software-interrupt although this is the same as a simple function call?
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Bob. I would prefer interrupt programming to the procedural programming. So as a part of the experiment, I want to do that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Shaunak,
i would like to use Software interrupt also. Please do you know now how to use it? When yes please send me, when possible your example.
Thanks for replying.
Rosine