[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
Giovanni
Site Admin
Posts: 13085
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 759 times
Been thanked: 637 times
Contact:

Re: [PATCH] AVR EXT

Postby Giovanni » Wed Apr 26, 2017 8:16 am

I recommend to keep all mcuconf.h files aligned in all demos and test applications. This thing goes out of control easily.

Giovanni

User avatar
tfAteba
Posts: 526
Joined: Fri Oct 16, 2015 11:03 pm
Location: Chartres, France
Has thanked: 81 times
Been thanked: 46 times

Re: [PATCH] AVR EXT

Postby tfAteba » Wed Apr 26, 2017 10:34 am

Hi Giovanni,

It is planned to be like you suggest. I will quickly take care of that :)
regards,

Theo.

User avatar
tfAteba
Posts: 526
Joined: Fri Oct 16, 2015 11:03 pm
Location: Chartres, France
Has thanked: 81 times
Been thanked: 46 times

Re: [PATCH] AVR EXT

Postby tfAteba » Sat Apr 29, 2017 12:21 am

Giovanni wrote:

I recommend to keep all mcuconf.h files aligned in all demos and test applications.

Done, All mcuconf.h files are now align.
regards,

Theo.

MGeo
Posts: 21
Joined: Wed Jul 26, 2017 12:05 pm
Been thanked: 3 times

Re: [PATCH] AVR EXT

Postby MGeo » Wed Jul 26, 2017 12:22 pm

Hi All,

I've been attempting to climb the Chibios learning curve, currently working on AVR examples learning to build and manage the configuration setting files.

I've been trying to run through HAL EXT example from testhal/AVR on Arduino Mega 2560 board without luck so far. I'm using ChibiOS_17.6.0.zip downloaded as a zip file from https://sourceforge.net/projects/chibio ... %2017.6.0/

I'm using the INT4 (PE4, Arduino D2) interrupt pin wired to a button with pull-up / ground connection attempting to trigger the interrupt.

Things build and load just fine, I get the serial term output showing I'm alive and running.

I am not able to get the interrupt to fire when toggling D2/INT4, no increment of isrCpt. I am monitoring Arduino D13 (LED, PB7) pin on my logic analyzer and it stays low no activity on D13 as D2 is toggled

Do the patches from this thread need to somehow be applied in order to get this example to work correctly. Any hints what I might be doing wrong?

Thanks,
George

User avatar
tfAteba
Posts: 526
Joined: Fri Oct 16, 2015 11:03 pm
Location: Chartres, France
Has thanked: 81 times
Been thanked: 46 times

Re: [PATCH] AVR EXT

Postby tfAteba » Wed Jul 26, 2017 8:36 pm

Hi MGeo,

I just saw you post, I going to take a look to ChibiOS_17.6.0.zip, normally, you do not need to patch that version with the patch I summit in this post before.

You can also use the trunk https://sourceforge.net/p/chibios/svn/HEAD/tree/trunk/ for sure it include the EXT driver, I'm using this with my robot.

I'm going to look the version you use and give you a feedback.
regards,

Theo.

User avatar
tfAteba
Posts: 526
Joined: Fri Oct 16, 2015 11:03 pm
Location: Chartres, France
Has thanked: 81 times
Been thanked: 46 times

Re: [PATCH] AVR EXT

Postby tfAteba » Wed Jul 26, 2017 9:49 pm

I just have the time to give a quick try. On both the trunk and ChibiOS_17.6.0, EXT driver is present. The code compile without error.

But effectively, It don't run as expected. The LED do not toggle and the counter is not incremented.

For the moment I did not understand what is happening.

I have to look carefully, because, the PCI support have been added to my work so I have to see if there is no conflict.

That will may be take several days but when I have the solution I will post to inform.
regards,

Theo.

User avatar
tfAteba
Posts: 526
Joined: Fri Oct 16, 2015 11:03 pm
Location: Chartres, France
Has thanked: 81 times
Been thanked: 46 times

Re: [PATCH] AVR EXT

Postby tfAteba » Wed Jul 26, 2017 11:40 pm

I have the confirmation of what I expected:
The demo does not work because of the PCI support added next to the EXT driver.

To make a quick test, I have remove some code of the PCI Low Level Driver in hal_ext_lld.c
That helped me to see that the PCI driver force the user of EXT driver to use external interruption incrementally.
The user must start to use INT0, not from INT4 such as in the demo. This is not a good thing.
At that point, with the modification of the demo, I was then able to run the demo correctly.

But that is not the only problem, I'm still working on the to find why when all the PCI code is present there is a conflict with the EXT part.

It will mostly be resolve very soon :) .
regards,

Theo.

MGeo
Posts: 21
Joined: Wed Jul 26, 2017 12:05 pm
Been thanked: 3 times

Re: [PATCH] AVR EXT

Postby MGeo » Thu Jul 27, 2017 10:01 am

Hi Theo,

Thanks for the quick response. I will try moving over from INT4 to INT0 and report back

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

George

Compiling C: main.c
avr-gcc -c -mmcu=atmega2560 -I. -gdwarf-2 -DF_CPU=16000000UL -O2 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=./main.lst -I../chibios/os/license -I../chibios/os/common/ports/AVR -I../chibios/os/common/ports/AVR/compilers/GCC -I../chibios/os/rt/include -I../chibios/os/common/oslib/include -I../chibios/os/hal/include -I../chibios/os/hal/osal/rt -I../chibios/os/hal/ports/AVR -I../chibios/os/hal/lib/streams -I../chibios/os/hal/boards/ARDUINO_MEGA -I../chibios/os/various -std=gnu11 -mrelax -fdata-sections -ffunction-sections -Wundef -MMD -MP -MF .dep/main.o.d main.c -o main.o
main.c:48:5: warning: excess elements in array initializer
{EXT_CH_MODE_DISABLED , NULL}, /* INT1 Config. */
^
main.c:48:5: warning: (near initialization for 'extcfg.channels')
main.c:49:5: warning: excess elements in array initializer
{EXT_CH_MODE_DISABLED , NULL}, /* INT2 Config. */
^
main.c:49:5: warning: (near initialization for 'extcfg.channels')
main.c:50:5: warning: excess elements in array initializer
{EXT_CH_MODE_DISABLED , NULL}, /* INT3 Config. */
^
main.c:50:5: warning: (near initialization for 'extcfg.channels')
main.c:51:5: warning: excess elements in array initializer
{EXT_CH_MODE_RISING_EDGE , extcb}, /* INT4 Config. */
^
main.c:51:5: warning: (near initialization for 'extcfg.channels')
main.c:52:5: warning: excess elements in array initializer
{EXT_CH_MODE_DISABLED , NULL}, /* INT5 Config. */
^
main.c:52:5: warning: (near initialization for 'extcfg.channels')
Last edited by MGeo on Thu Jul 27, 2017 10:23 am, edited 2 times in total.

User avatar
tfAteba
Posts: 526
Joined: Fri Oct 16, 2015 11:03 pm
Location: Chartres, France
Has thanked: 81 times
Been thanked: 46 times

Re: [PATCH] AVR EXT

Postby tfAteba » Thu Jul 27, 2017 10:18 am

Hi MGeo,

I have already did that, but it is not enough, there is still another problem that I didn't yet catch.

But try it if you want and report your observation.

I will work on it tonight and hope to find what cause the conflict.
regards,

Theo.

MGeo
Posts: 21
Joined: Wed Jul 26, 2017 12:05 pm
Been thanked: 3 times

Re: [PATCH] AVR EXT

Postby MGeo » Thu Jul 27, 2017 10:57 am

Hi Theo,

As expected based on your posts, I move the INT pin from INT4 to INT0 and I get the Interrupt to fire.

Latency from my test is about 0.18 mSec.

Dropbox link: Screen cap

Dropbox link: Zoom in with time measurement

George


Return to “AVR Support”

Who is online

Users browsing this forum: No registered users and 3 guests