Skip to content

rtl8195am : fix greentea test fails (test_timeout & test_timerevent) #6522

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

Conversation

M-ichae-l
Copy link
Contributor

@M-ichae-l M-ichae-l commented Apr 2, 2018

Description

Two greentea tests have the same issues.

RTL8195AM has a hardware limitation which is 30.5 us per tick for us_ticker. When execute these tests, it is necessary to wait at least two whole tick, 62 us.

Both of the tests, are using Semaphore to release() attach callback with 0 delay and wait() with 0 delay, then compare the sem_slots. However, when apply the attach callback, the ticker is being used (https://docs.mbed.com/docs/mbed-os-api-reference/en/latest/APIs/tasks/Ticker/) and this is linked to the ticker hardware limitation.

Pull request type

[X] Fix

Two greentea tests have the same issues.
--Test-timeout, case ”Zero delay (attach)" and case” Zero delay (attach_us)”
This issue is metioned in issue ARMmbed#6410 .
--Test-timerevent, case "Test insert_absolute zero" and case "Test insert_absolute timestamp from the past”.

RTL8195AM has a hardware limitation whitch is 31.5 us per tick for us_ticker. When execute these tests, it is necessary to wait at least two whole tick, 62us.
@cmonr
Copy link
Contributor

cmonr commented Apr 3, 2018

@M-ichae-l Thank you for looking into the issue and the technical explanation.

We'll run morph test a couple of times since the issue is intermittent.

/morph build

@cmonr cmonr added the needs: CI label Apr 3, 2018
@mbed-ci
Copy link

mbed-ci commented Apr 3, 2018

Build : SUCCESS

Build number : 1635
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/6522/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Apr 3, 2018

@mbed-ci
Copy link

mbed-ci commented Apr 3, 2018

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 3, 2018

@M-ichae-l Thanks for the fix, I got one concern with the fix - tests should not contain ifdef targets (some code is not run for some), can this fix be made more generic? It can be applied to any other targets? If the ifdef is removed, will be test still valid and should pass for any hw ticker?

@fkjagodzinski Can you please review?

@M-ichae-l
Copy link
Contributor Author

M-ichae-l commented Apr 3, 2018

Hi, @0xc0170
The reason why I put the ifdef condition is to ensure that other targets are not affected. If you feel that the added delay is acceptable then the change can be made universal. Other targets should have different timing per tick, They may have different fixs or even not necessary to have a fix.

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 3, 2018

The reason why I put the ifdef condition is to ensure that other targets are not affected. If you feel that the added delay is acceptable then the change can be made universal. Other targets should have different timing per tick, They may have different fixs or even not necessary to have a fix.

If that is needed , should be done for all targets. Firstly, why is this actually needed ? Can't this be handled in the target implementation (the test stays as it is, target HAL for ticker needs an update?) ?

Generally, test is generic, no "ifdef targets". The problem often is somewhere else than in the test if this is needed

@fkjagodzinski
Copy link
Member

I suppose the us_ticker_fire_interrupt() implementation for RTL8195AM needs an update to pass these tests. Similar issue was raised for other targets. For reference see issue #6319 or NRF51 implementation which uses NVIC_SetPendingIRQ() to overcome similar 2 tick limitation.

void us_ticker_fire_interrupt(void)
{
core_util_critical_section_enter();
m_common_sw_irq_flag |= US_TICKER_SW_IRQ_MASK;
NVIC_SetPendingIRQ(RTC1_IRQn);
core_util_critical_section_exit();
}

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 9, 2018

@M-ichae-l Did @fkjagodzinski answer it ? Can you update the tickers implementation?

@M-ichae-l
Copy link
Contributor Author

I have tried the NVIC_SetPendingIRQ() implementation. This is not able to overcome the issue.

@0xc0170 0xc0170 requested a review from c1728p9 April 11, 2018 11:22
@0xc0170
Copy link
Contributor

0xc0170 commented Apr 11, 2018

RTL8195AM has a hardware limitation which is 31.5 us per tick for us_ticker. When execute these tests, it is necessary to wait at least two whole tick, 62 us.

What peripheral is used there? No other peripheral is available that would do the trick? where is this 31.5 us coming from? Can you describe the problem in detail.

We shall find another solution to the problem, wait() does not solve it as it is presented here.

@M-ichae-l
Copy link
Contributor Author

Hi, @0xc0170
Sorry for the late reply. Peripheral G-timer is used and there is no other peripheral available. The ticker has us per tick: 30.5. G-timer needs at least 2 ticks (~62us) to trigger the interrupt which is too long. One tick is for load the counter the other is for issue the IRQ.
I will follow up the #6536. Thank you!

@cmonr
Copy link
Contributor

cmonr commented Apr 27, 2018

@M-ichae-l Now that #6536 is in, how does it affect this PR?

@cmonr
Copy link
Contributor

cmonr commented May 7, 2018

Closing since #6536 appears to have solved the problem in a generic way and no response has been given in this PR.

@cmonr cmonr closed this May 7, 2018
@cmonr cmonr removed the needs: work label May 7, 2018
@studavekar
Copy link
Contributor

Closing since #6536 appears to have solved the problem in a generic way and no response has been given in this PR.

@cmonr looks like on master test-timerevent, case "Test insert_absolute zero" and case "Test insert_absolute timestamp from the past”. still fails.

@M-ichae-l M-ichae-l deleted the rtl8195am-fix-greentea-test-fails-(test_timeout-&-test_timerevent) branch October 26, 2018 03:20
@M-ichae-l M-ichae-l restored the rtl8195am-fix-greentea-test-fails-(test_timeout-&-test_timerevent) branch October 26, 2018 03:21
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

Successfully merging this pull request may close these issues.

6 participants