[PATCH] AVR EXT Topic is solved

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

Moderators: utzig, tfAteba

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

Re: [PATCH] AVR EXT

Postby MGeo » Thu Jul 27, 2017 11:07 am

Hi Theo,

I think you already knew this, simple moving of INT from INT0 to INT4 is not enough, there is some more fundamental issue. Latency of 0.18 mSec seems excessive as another indication of driver issue.

The output from serial term is repeatedly showing " "

EXT hal test started...
EXT hal test started...
EXT hal test started...


Indicating that main is repeatedly restarting?

George

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 » Thu Jul 27, 2017 1:05 pm

MGeo wrote:
I did notice the warnings below when compiling main.c:


About the Warning, I will modify the demo to remove them. To do that, put the configuration of the External interruption that you whant to use. In your case:

Code: Select all

/**
 * @brief  EXT Driver configurations.
 */
static const EXTConfig extcfg = {
  {
    {EXT_CH_MODE_RISING_EDGE , extcb},  /* INT0 Config. */
  }
};



MGeo wrote:
Indicating that main is repeatedly restarting?


Yes, this is because you did not select the rigth EXT interrupt channel in mcuconf.h file locate in the demo directory.

instead of:

Code: Select all

/*
 * EXT drivers system settings.
 */
#define AVR_EXT_USE_INT0                   FALSE
#define AVR_EXT_USE_INT1                   FALSE
#define AVR_EXT_USE_INT2                   FALSE
#define AVR_EXT_USE_INT3                   FALSE
#define AVR_EXT_USE_INT4                   TRUE
#define AVR_EXT_USE_INT5                   FALSE


it should be

Code: Select all

/*
 * EXT drivers system settings.
 */
#define AVR_EXT_USE_INT0                   TRUE
#define AVR_EXT_USE_INT1                   FALSE
#define AVR_EXT_USE_INT2                   FALSE
#define AVR_EXT_USE_INT3                   FALSE
#define AVR_EXT_USE_INT4                   FALSE
#define AVR_EXT_USE_INT5                   FALSE
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 » Thu Jul 27, 2017 1:06 pm

But for me it is not enough, I will look at this tonight.
regards,

Theo.

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

Re: [PATCH] AVR EXT

Postby MGeo » Fri Jul 28, 2017 10:16 am

Hi Theo,

Ah yes, I failed to select the right EXT interrupt channel in mcuconf.h file. Once I did per above latency has dropped to 4.25 uS.

https://ibb.co/eqf9ek

George

PS: I can not find a way to post images (ie logic analyzer screen caps) to this forum. I've tried img tags and url, but it always shows a broken link. If anyone knows how please advise. I think it would add value to the thread. Thanks - George

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 Jul 28, 2017 6:56 pm

Hi MGeo,

If you want to add an image, when you write a post, see bellow, there is two onglets (Options and Attachments).

Select the attachments and then use the add button to add your image.

I did it with you image Cap2.png

Attachments
Cap2.png
Cap2 example
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 » Fri Jul 28, 2017 7:00 pm

MGeo,

We try to keep topics focus on one problem at time. So please for next time, you may open other posts when you have questions that are not related to the concerned post.

Thanks.
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 » Mon Jul 31, 2017 8:08 pm

Hi MGeo,

I finally fix all the conflicts in the trunk.

I have try to debug and find the solution of bug but it though me more time than expected. So I just down grade the actual code by removing the support of the PCINT. I will re-implement this part by using patch submit by Marco.

Thanks for finding the bug.

It is now fixed in the trunk.
regards,

Theo.

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

Re: [PATCH] AVR EXT

Postby MGeo » Tue Aug 01, 2017 11:23 am

Hi Theo,

I've stated debug in Atmel Studio using simulator. I'm seeing that INT0 initializes EIMSK and EICRA correctly, and INT4 does not (per screen caps).

I'm still trying to grasp the code, but I believe their might be an (not directly related?) issue that the following will not work as intended for non-zero based INT's. If only INT4 is defined, we would still end up with declare_extint_isr(0), which not generate a compile error but would define the incorrect INT0 ISR vector.

from hal_ext_lld.c

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


and from hal_ext_lld.h

Code: Select all

#define EXT_INT_NUM_CHANNELS                                                \
  (EXT_INT0_PRESENT + EXT_INT1_PRESENT + EXT_INT2_PRESENT +                 \
   EXT_INT3_PRESENT + EXT_INT4_PRESENT + EXT_INT5_PRESENT)

.
Attachments
cap3_init_EXT4.png
Configured for INT4
cap3_init_EXT0.png
Configured for INT0

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 01, 2017 2:15 pm

Hi MGeo,

What version of ChibiOS do you use?

I have update the trunk yesterday, so that EXT work as expected. I have remove the code that was generated the conflict.

You can use any of the EXT (INT0...INT5) to make your test.
But for that you need to used the lasted source code!!!
You can find it here: https://sourceforge.net/p/chibios/svn/HEAD/tree/trunk/
You just need to click on the button " Download Snapshot"
The testhal/AVR/EXT/ will work out of the box now.

Please let me know how you tests will run. Do not hesitate to give a feedback.

Thanks
regards,

Theo.

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

Re: [PATCH] AVR EXT

Postby MGeo » Wed Aug 02, 2017 10:30 am

Hi Theo,

I've been using Chibios stable release 17.6.0 from here https://sourceforge.net/projects/chibio ... %2017.6.0/

I downloaded lastest trunk from your link above. I see that hal_ext_lld.c has major changes, much easier to follow. It looks like PCINTx support is removed from EXT for now?

A quick check with simulator looks much better. It even looks to be handling multiple INTs correctly! I'll continue testing and report back.

Thanks for your help.
George
Attachments
cap4_init_EXT0_and_EXT4.png
Configured for INT0 and INT4
cap4_init_EXT4.png
Configured for INT4
cap4_init_EXT0.png
Configured for INT0
Last edited by MGeo on Wed Aug 02, 2017 10:51 am, edited 2 times in total.


Return to “AVR Support”

Who is online

Users browsing this forum: No registered users and 14 guests