[PATCH] AVR EXT Topic is solved

ChibiOS public support forum for topics related to the Atmel AVR family of micro-controllers.

Moderators: utzig, tfAteba

User avatar
tfAteba
Posts: 547
Joined: Fri Oct 16, 2015 11:03 pm
Location: Strasbourg, France
Has thanked: 91 times
Been thanked: 48 times

Re: [PATCH] AVR EXT

Postby tfAteba » Sun Aug 20, 2017 12:50 pm

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.
regards,

Theo.

MGeo
Posts: 22
Joined: Wed Jul 26, 2017 12:05 pm
Been thanked: 4 times

Re: [PATCH] AVR EXT

Postby MGeo » Sun Aug 20, 2017 2:24 pm

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
Attachments
EXT - Copy.zip
(14.18 KiB) Downloaded 263 times
cap7_init_EXT0_and_EXT4.png

MGeo
Posts: 22
Joined: Wed Jul 26, 2017 12:05 pm
Been thanked: 4 times

Re: [PATCH] AVR EXT

Postby MGeo » Sun Aug 20, 2017 3:07 pm

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.

Marco
Posts: 128
Joined: Tue Apr 16, 2013 8:22 pm
Has thanked: 4 times
Been thanked: 11 times

Re: [PATCH] AVR EXT

Postby Marco » Tue Aug 22, 2017 4:00 pm

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

User avatar
tfAteba
Posts: 547
Joined: Fri Oct 16, 2015 11:03 pm
Location: Strasbourg, France
Has thanked: 91 times
Been thanked: 48 times

Re: [PATCH] AVR EXT

Postby tfAteba » Tue Aug 22, 2017 9:01 pm

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.
regards,

Theo.

Marco
Posts: 128
Joined: Tue Apr 16, 2013 8:22 pm
Has thanked: 4 times
Been thanked: 11 times

Re: [PATCH] AVR EXT

Postby Marco » Fri Aug 25, 2017 10:02 am

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
Attachments
hal_ext_lld.zip
(6.03 KiB) Downloaded 254 times

User avatar
tfAteba
Posts: 547
Joined: Fri Oct 16, 2015 11:03 pm
Location: Strasbourg, France
Has thanked: 91 times
Been thanked: 48 times

Re: [PATCH] AVR EXT

Postby tfAteba » Fri Aug 25, 2017 3:57 pm

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
regards,

Theo.

User avatar
tfAteba
Posts: 547
Joined: Fri Oct 16, 2015 11:03 pm
Location: Strasbourg, France
Has thanked: 91 times
Been thanked: 48 times

Re: [PATCH] AVR EXT

Postby tfAteba » Sun Aug 27, 2017 10:14 am

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.
regards,

Theo.

Marco
Posts: 128
Joined: Tue Apr 16, 2013 8:22 pm
Has thanked: 4 times
Been thanked: 11 times

Re: [PATCH] AVR EXT

Postby Marco » Sun Aug 27, 2017 3:34 pm

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

User avatar
tfAteba
Posts: 547
Joined: Fri Oct 16, 2015 11:03 pm
Location: Strasbourg, France
Has thanked: 91 times
Been thanked: 48 times

Re: [PATCH] AVR EXT

Postby tfAteba » Sun Aug 27, 2017 7:58 pm

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.
regards,

Theo.


Return to “AVR Support”

Who is online

Users browsing this forum: No registered users and 10 guests