Page 1 of 1
Problem UART1 Mega2560
Posted: Sun Dec 11, 2016 6:05 pm
by stregato
Goodmorning everyone
I ran several tests, but I can not use UART1 Interrupt with Arduino Mega2560 I tried with every door hardware without any success

Re: Problem UART1 Mega2560
Posted: Sun Dec 11, 2016 6:28 pm
by QMESAR
Hi
Are you testing on Real hardware or in the simulator not sure but I think interrupts is not supported in simulation
I am interested in this question as well

Re: Problem UART1 Mega2560
Posted: Sun Dec 11, 2016 7:38 pm
by stregato
QMESAR wrote:Hi
Are you testing on Real hardware or in the simulator not sure but I think interrupts is not supported in simulation
I am interested in this question as well

No I'm performing the tests directly on the hardware simulation of interrupts know that does not work

Re: Problem UART1 Mega2560
Posted: Tue Dec 13, 2016 1:28 pm
by stregato

I notice the problem nobody cares even a simple response from the employees could give pleasure

Re: Problem UART1 Mega2560
Posted: Tue Dec 13, 2016 2:07 pm
by LeighM
Sorry, I'll take a look now
(I read this post at home at the weekend, so the read flag got set

Re: Problem UART1 Mega2560
Posted: Tue Dec 13, 2016 3:23 pm
by stregato
LeighM wrote:Sorry, I'll take a look now
(I read this post at home at the weekend, so the read flag got set

I wish to thank you for your concern

Re: Problem UART1 Mega2560
Posted: Tue Dec 13, 2016 3:52 pm
by LeighM
Hi,
I have not managed to find an ATmega2560 to test this on, but have tested with an ATmega1281 and found that the UART1 interrupt worked OK.
Would you like to post your program so that we can check it over?
Thanks
Leigh
Re: Problem UART1 Mega2560
Posted: Tue Dec 13, 2016 11:01 pm
by EtsDriver
********
REMEMBER TO FIRST APPLY THE NEWEST PATCHED V7.1.1.0 files!!**********
--> Just to be sure we dont try to solve anything that has been allready solved...
I investigated this a bit with Arduino Mega2560 (older one). (With old bootloader, changed to newer v2 bootloader and then without bootloader.) All worked fine.
Connected a simple wire from RX0 to RX1 to trigger the RX1 interrupt.
Attached program proves that RX1 interrupt
works, try disabling or enabling this bit of code and load to arduino (i used Xloader to load .hex files to device) and see what happens:
I have to remind you to "flush" (by reading it) the UDR1 register in the macro for example to make program work more faster. If this is not done, the macro might not fire anymore or fires at very long interval (you can see this by looking at your TX led and sending a character to arduino).
This attached program dumps the Atmega internal registers to user and shows that there is data available on the receive buffer of UART1. If you put the UDR "reading" on in the UART1int macro, you see that the macro fires and the UDR printout shows some small value.
If value is 160, the UDR1 has not been flushed(=read to any variable):
To flush UDR1 register, you must use variable (remember to put FCV_ in front of and variable name in uppercase).
After flushing UDR1:
tested same on UDR0, if not emptied shows something like this:
BTW as a side product from this investigation: To kill your arduino serial communications easily, try setting the UDR0 to 0... Program jams pretty fine.
Re: Problem UART1 Mega2560
Posted: Tue Dec 13, 2016 11:29 pm
by stregato
I tried with UART channel 2 channel 3 and channel 4
Re: Problem UART1 Mega2560
Posted: Wed Dec 14, 2016 10:51 am
by LeighM
Could it be the receive string in the interrupt macro that is causing an issue?
Maybe try outputting a high to a pin at the start of the interrupt macro and set low at the end, to test if the routine is being entered, and exited.
Re: Problem UART1 Mega2560
Posted: Wed Dec 14, 2016 2:30 pm
by stregato
I make a premise when using UART0 RX works fine I wanted to use UART1 RX to not have to continue to pull the interface that connects to UART0 port that is clearly used by the programmer, I understand that the problem is not resolved continue to connect and disconnect the interface Thanks for the help

Re: Problem UART1 Mega2560
Posted: Thu Dec 15, 2016 10:31 am
by EtsDriver
Hi!
I see your program is missing RS232 init..
And here is a tiny suggestion for receiving data on RXint:
You could do the receiving using something like this, as this will time out if timeout is specified or if the \r is received, it will jump out.
I personally use this bit more sophisticated method, but usually on UART0:
Re: Problem UART1 Mega2560
Posted: Mon Jan 02, 2017 12:16 am
by maxtisc
Salve Stregato
Volevo sapere se sei riuscito a risolvere il problema dell' interrupt rx sul mega2560, è lo stesso problema che ho anch' io e non sò come venirne a capo
grazie dell' attenzione
Hi Stregato
I wanted to know if you managed to solve the problem of 'rx interrupt on Mega2560, is the same problem I too' and I do not know how to deal with them
Thanks for your attention