Page 8 of 9

Re: [PATCH] AVR EXT

Posted: Sun Aug 20, 2017 12:50 pm
by tfAteba
Thanks for the clarifications. So if you can adjust the frequency at which MPU can trigger the interruption, I don't see where is your problem then.
Above all
MPU can be configured to sample sensors at a user defined frequency
that all you need I think.

Just try to implement your application and then ask ask your questions if yoy have problem at that time :D

PS: This discussion is too generic, not really related to EXT driver so please make a new topic next time, thanks.

Re: [PATCH] AVR EXT

Posted: Sun Aug 20, 2017 2:24 pm
by MGeo
Giovanni wrote:Note that you can write plain ISRs without putting any RTOS code inside, no overhead in that case.

Giovanni


Hi Giovanni,

I ran a quick test per above with Chibios and plain ISRs for INT0 and INT1, as expected the interrupt latencies (1.4 and 4.7 uSec) reflect no additional overhead.

Thanks,
George

Re: [PATCH] AVR EXT

Posted: Sun Aug 20, 2017 3:07 pm
by MGeo
tfAteba wrote:PS: This discussion is too generic, not really related to EXT driver so please make a new topic next time, thanks.


Ok, sorry. Will do.

Re: [PATCH] AVR EXT

Posted: Tue Aug 22, 2017 4:00 pm
by Marco
Hi,

Sad to see the patch got reverted but logical since it was not working for INTx interrupts.. I see MGeo identified the problem in this post. I think when the 'Interrupt handlers for INT-type interrupts.' is rewritten correctly both PCINTx and INTx should work.

I think (not tested) it is enough to replace this code block:

Code: Select all

/*
 * Interrupt handlers for INT-type interrupts.
 */
#if 0 < EXT_INT_NUM_CHANNELS
declare_extint_isr(0);
#endif
#if 1 < EXT_INT_NUM_CHANNELS
declare_extint_isr(1);
#endif
#if 2 < EXT_INT_NUM_CHANNELS
declare_extint_isr(2);
#endif
#if 3 < EXT_INT_NUM_CHANNELS
declare_extint_isr(3);
#endif
#if 4 < EXT_INT_NUM_CHANNELS
declare_extint_isr(4);
#endif
#if 5 < EXT_INT_NUM_CHANNELS
declare_extint_isr(5);
#endif

by:

Code: Select all

/*
 * Interrupt handlers for INT-type interrupts.
 */
#if AVR_EXT_USE_INT0
declare_extint_isr(0);
#endif
#if AVR_EXT_USE_INT1
declare_extint_isr(1);
#endif
#if AVR_EXT_USE_INT2
declare_extint_isr(2);
#endif
#if AVR_EXT_USE_INT3
declare_extint_isr(3);
#endif
#if AVR_EXT_USE_INT4
declare_extint_isr(4);
#endif
#if AVR_EXT_USE_INT5
declare_extint_isr(5);
#endif


@tfAteba, when do you think you have time to reimplement this?

Marco

Re: [PATCH] AVR EXT

Posted: Tue Aug 22, 2017 9:01 pm
by tfAteba
Hi Marco,

I hope I will have time to work on it this weekend.

Marco wrote:
I think (not tested) it is enough to replace this code block:


Did you have the board and can you make the test? It will be helpful.

Re: [PATCH] AVR EXT

Posted: Fri Aug 25, 2017 10:02 am
by Marco
tfAteba wrote:Hi Marco,

I hope I will have time to work on it this weekend.

Marco wrote:
I think (not tested) it is enough to replace this code block:


Did you have the board and can you make the test? It will be helpful.


Hi tfAteba,

Attached are hal_ext_lld.c and hal_ext_lld.h which support both INT and PCINT interrupts. I fixed both of them because they seemed to have the same problem. Now it is possible to enable for example INT4 and PCINT2 while others are disabled. I tested it on an ATMega162, but it should also work on others. Can you verify this because i don't have any other boards to test on?

Marco

Re: [PATCH] AVR EXT

Posted: Fri Aug 25, 2017 3:57 pm
by tfAteba
Hi Marco,

Thanks for the archive, I will test this on the Arduino Mega2560 board and also on Arduino Uno328p to see if every things is fine.

I will give a feedback this week-end :D

Re: [PATCH] AVR EXT

Posted: Sun Aug 27, 2017 10:14 am
by tfAteba
Hello Marco,

As promise, I made a test of your file.

By replacing the hal_ext_lld.(h and c) files with your files, the testhal/AVR/MEGA/EXT is not working any more.
With the current driver, this demo works for all the board whose are currently supported (uno, mini, nono, mega...) so for the moment I do not bump your changes.

I suspect that PCINT for your device ATMega162 as to be manage differently from PCINT of the ATMega2560.
I will read and compare the two datasheet to see if there is any differences and explanations of why it is not working.

Did you also use the ATMega2560 datasheet when you implemented the driver? ;)

Also you files looks the same as last time, what did you change this time?


I do not have a board with the mcu you are using so I can not make test to the some board.

Any way I'm still working on to integrate the PCINT support on the driver.

Thank you.

Re: [PATCH] AVR EXT

Posted: Sun Aug 27, 2017 3:34 pm
by Marco
Hi tfAfteba,

Thank you for testing the attached files of my last post.
I replaced the interrupt handler declarations for both PCINT and INT. I guess there are some differences between the atmega162 and atmega2560. Unfortunately I don't have any other mcu to test on :(

Maybe you can debug both versions of the ext driver (trunk and modified) and check what registers contain different values. Atmel Studio has a nice feature for this: I/O view.

I didn't compare the datasheets so I could have missed something. I don't have access to the code right now, but if I remember well there is some special code for the atmega162..

Thank you!

Marco

Re: [PATCH] AVR EXT

Posted: Sun Aug 27, 2017 7:58 pm
by tfAteba
Hi marco,

Marco wrote:
Thank hank you for testing the attached files of my last post.


You are welcome.


Marco wrote:
I guess there are some differences between the atmega162 and atmega2560


I will read both datasheet to see if there is some differences and if the both can be manage the same way.

Marco wrote:
I guess there are some differences between the atmega162 and atmega2560

Do not worry I will try to find out what is the problem.

Thanks you.