Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STM32L4 InterruptIn has stopped working in Mbed-dev rev:58 Mbed rev: 112 #1509

Closed
star297 opened this issue Jan 20, 2016 · 13 comments
Closed

Comments

@star297
Copy link
Contributor

star297 commented Jan 20, 2016

The title says it all.
The example:
https://developer.mbed.org/teams/ST/code/Nucleo_read_button_interrupt/?platform=ST-Nucleo-L476RG
no longer works, program freezes when button is pressed.
Noticed this on Mbed-dev rev:58 Mbed rev: 112, but may have broke before in previous revisions.

Currently working with Mbed-dev rev: 33

@star297
Copy link
Contributor Author

star297 commented Jan 23, 2016

Not so sure it is to do with revisions.
Something I found, if I simply add AnalogIn aIn(PA_1);
It runs correctly.
Why we need to set an AnalogIn pin?
How does this affect the InertupIn function?

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 25, 2016

cc @bcostm @adustm

@star297
Copy link
Contributor Author

star297 commented Jan 25, 2016

I have noticed that the L476 does not require the LowPowerConfiguration code to achieve low power in deepsleep, where similar code is needed for the L152. It appears the GPIO's initialise in the low power mode. Perhaps the problem is with the GPIO's latching the IRQ's and these need to be configured in the same way as the L152 on start up, then applying LowPowerConfiguration code to set the unused GPIO's in the user program.

@bcostm
Copy link
Contributor

bcostm commented Jan 27, 2016

I've just checked the Nucleo_sleep example on mbed IDE with mbed v112 and mbed-dev v53 and I confirm that the pressed function is never entered when the user_button is pressed.

I've exported this example on uVision using mbed-dev and it is OK with sleep and deepsleep.
I've also checked using ARM_MICRO and ARM_STD lib and -O0 and -O3 options. In all cases it's OK.

So, it seems there is something wrong only with the mbed IDE but I have no idea what?

@star297
Copy link
Contributor Author

star297 commented Jan 27, 2016

This example shows the problem:
https://developer.mbed.org/teams/ST/code/Nucleo_read_button_interrupt/?platform=ST-Nucleo-L476RG

I tried using uVision and was not working.
However if you change the pin define order to this:

DigitalOut myled(LED1);
InterruptIn mybutton(USER_BUTTON);

then it does work on Mbed and uVision (without defining the AnalogIn pin).

However before we go any further the Mbed IDE/Compiler need setting correctly.
Build Details is only showing 512K flash and 32k RAM. It should be 1M Flash and 128K RAM.
This is also true with the Disco-L476 and is suffering from similar issues.
Also issue #1348 needs checking.
I think all these problems are tied up and could simply be down to the complier WEB interface.

@0xc0170 Martin could you get the WEB guys to check and correct these settings for both Targets please, we can't move on until this is fixed.

@star297
Copy link
Contributor Author

star297 commented Feb 15, 2016

cc @bcostm @adustm

Guys, could you take a good look at the interrupt functionality as soon as possible please.
The Mbed Flash/RAM settings are now correct.
It appears there are other problems emerging, MBED-RTOS is also not running.
It is not revision dependant, not been working properly from the outset.
Setting multiple interrupts causes all sorts of lockup and weird code jumping problems.
In some cases enabling one defined interrupt pin causes all the other defined interrupt pins to become active.

@bcostm
Copy link
Contributor

bcostm commented Feb 17, 2016

Problem confirmed with Nucleo_read_button_interrupt example + mbed v114 or mbed-dev v65 + mbedIDE + NUCLEO_L476 board. But same example works on the DISCO_L476 board.

I made a diff of DISCO and NUCLEO cmsis folders and there is a difference in the stm32l476xx.icf files. SRAM1/SRAM2 regions are inverted. This needs to be changed but it is for IAR, so it is not related to this problem.

I have tried the same example with uVision and it works. So, impossible to reproduce it with a debugger. It will be complicated to find the solution...

@adamgreen
Copy link
Contributor

If you can attach GDB to the board when the online built code is failing, you should still be able to grab some information about the state of the device during the failure. You just won't have symbols so it will make things a bit harder.

If you do happen to do this and it breaks in successfully, you can grab a snapshot of the system and post a link to it for me to look at. These GDB commands will cause it to dump the important state of the device:

set pagination off
set logging on
set var $ptr=0x10000000
while $ptr < 0x10008000
x/4wx $ptr
set var $ptr+=16
end
info all-registers
set logging off
set pagination on

I would need access to the GDB.TXT created by the above commands and the mbed produced .bin file which was running on the device. With those 2 files I can load up the state of the device under GDB remotely and take a look.

@bcostm
Copy link
Contributor

bcostm commented Feb 18, 2016

We've discovered that NVIC_RAM_VECTOR_ADDRESS is set to 0x20000000 instead of 0x10000000 in the cmsis_nvic.c file.
I checked the 0x10000000 value in the mbed IDE with mbed-dev and the Nucleo_read_button_interrupt example works with InterruptIn placed before or after DigitalOut. Can you please try also ? If ok for you too I will send a pull request.

@star297
Copy link
Contributor Author

star297 commented Feb 18, 2016

Spot on, that has fixed the interrupt problem.
Tried it with multiple interrupts triggering Tickers, works stable as expected.
Also checked using HSE @ 80MHz.
With the RTC now working, the L476 is pretty much sorted 👍

@bcostm
Copy link
Contributor

bcostm commented Feb 19, 2016

ok cool 😃 thanks for verifying it.
I will send a PR asap.

@ciarmcom
Copy link
Member

ciarmcom commented Aug 1, 2016

ARM Internal Ref: IOTMORF-223

@sg- sg- removed the mirrored label Aug 12, 2016
@sg-
Copy link
Contributor

sg- commented Jan 16, 2017

Confirmed to be resolved.

@sg- sg- closed this as completed Jan 16, 2017
deepakvenugopal added a commit to deepakvenugopal/mbed-os that referenced this issue Feb 9, 2018
…changes from c9bf20f..43c7ec2

43c7ec2 Merge branch 'release_internal' into release_external
ed76459 Merge pull request ARMmbed#1558 from ARMmbed/IOTTHD-2195
8d3bcb7 Add new function to unit tests
56f66a4 Review correction
8b7d018 Move indirect queue size public API to net_interface
d877c9e Review corrections
c25e476 Remove Eclipse project files for external release
d51f442 Merge branch 'release_internal' into release_external
135c48d Increase Thread SED buffer size for big packets
70931a7 Fix indirect queue packet ordering
10e51a4 API for changing Thread SED parent buffer size
6122d24 dereference null value issue fixed. (ARMmbed#1557)
d1378dc Clear IPv6 neighbor cache in partition change (ARMmbed#1554)
7610e91 Child neighbor entry updates (ARMmbed#1550)
c727295 cleared neighbours with child address that are not ours (ARMmbed#1549)
80b4d72 Thread partition merge mode TLV change (ARMmbed#1546)
edd7599 RLOC was updated before clearing child info (ARMmbed#1547)
a666056 router short address set to 0xfffe for non routers (ARMmbed#1543)
759ab05 delete route set and link set entries for a router ID (ARMmbed#1540)
23a1265 REED advertisement handling (Thread spec 5.16.3): (ARMmbed#1535)
0a32cb4 added active and pending timestamps to child update response (ARMmbed#1533)
d0eec80 Fix error case memory leak (ARMmbed#1537)
da9860f Pending set after link sync (ARMmbed#1526)
ffa1569 Thread router network data update after link sync (ARMmbed#1530)
3b46d8d Fix defects found by coverity (ARMmbed#1529)
3a57101 Fix compiler warnings and update traces (ARMmbed#1523)
c288227 Add extension check for partition weight drop in parent selection (ARMmbed#1521)
d8dea28 network data cleared after router forms new partition (ARMmbed#1525)
44a85e5 removed router flagging for thread_management_server file (ARMmbed#1524)
1cbced9 Merge pull request ARMmbed#1520 from ARMmbed/IOTTHD-2105_2
3d07365 Review corrections to network data clearing
22a0375 Clear network data from lost children
ffd8517 added a new thread management function (ARMmbed#1519)
80af9cb Thread BR network data clearing (ARMmbed#1518)
5a6f6b5 thread nvm valgrind uninitialized data fix (ARMmbed#1517)
d5e2198 Add API for partition weighting set (ARMmbed#1513)
8811d6f multicast forwarding scope changed and address registration updated. (ARMmbed#1516)
c277384 printf to tr_info (ARMmbed#1515)
bb21264 Thread combined nvm test (ARMmbed#1507)
76f7725 Primary BBR fixes from interop (ARMmbed#1512)
12ed5ab FHSS unit test: fixed fhss mac interface test (cherry picked from commit 805eb42e4416b00cc018dc32dceb353d0b6c8bb6)
dd21ea9 Remvoed unnecessary trace print's.
cb6e78b FHSS unit test: fixed fhss beacon tasklet test (cherry picked from commit abe6d671b058f4f069741eab24d51e4d62d550b0)
237b3d4 Fhss info print (ARMmbed#1486)
0f39a47 FHSS: Do not update synch monitor right after superframe change (cherry picked from commit 99d50ad9d7f8dad80f10c2a4303f4e75ab31a3c2)
c9a098f Fixed Timeoout force which actually never generate timeout.
957c7fb Pana server and client update:
ae230e5 FHSS: Update Beacon synch info in critical state
84bd8a4 FHSS: Synchronization must be done in critical state
fb1b163 Pan coordinator blacklist update
39fe6ba Added missing HAVE_RPL compiler flag
16a1bc5 MLE bootsrap and message timeout update
eeb2d39 enable BBR to support multicast registration in non   commercial networks (ARMmbed#1509)
4ea2bf8 uri modified. (ARMmbed#1510)
f443853 timeout corrected for neighbour entry (ARMmbed#1508)
ea93c1f Thread dev conf taken use (ARMmbed#1503)
5d5b239 bug fix in bbr start (ARMmbed#1505)
8dbd521 commented a trace. (ARMmbed#1504)
145dbdf device conf copy fix (ARMmbed#1502)
f60268f eid&random mac moved to device conf struct (ARMmbed#1497)
df18635 Let MAC choose address when mesh forwarding
42f916b fixed BBR stop to remove network data and routing information (ARMmbed#1500)
e058c2a pbbr changes (ARMmbed#1499)
1ece307 Merge pull request ARMmbed#1485 from ARMmbed/merge_release_back
dda8164 thread address handling updated. (ARMmbed#1496)
1dc21a1 thread extension fixes. (ARMmbed#1495)
543fe98 Merge branch 'release_internal'
bade70e Dua req changes (ARMmbed#1494)
1979df8 added status to MLR response and implemeted BMLR.ntf multicast. (ARMmbed#1492)
1807c01 mle class initialisation (ARMmbed#1488)
d809831 Merge pull request ARMmbed#1479 from ARMmbed/merge_release_to_master
bce812d Update license to Thread test file (ARMmbed#1483)
aaa4b1f Revert eclipse file removal

git-subtree-dir: features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack
git-subtree-split: 43c7ec2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants