Skip to content

add OSHChip as an mbed target #5892

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

Merged
merged 10 commits into from
Feb 14, 2018
Merged

add OSHChip as an mbed target #5892

merged 10 commits into from
Feb 14, 2018

Conversation

drewcassidy
Copy link
Contributor

@drewcassidy drewcassidy commented Jan 20, 2018

Description

Add a target for the OSHChip, a miniature nRF51822 board, along with pin name definitions

board

Todo

Deploy notes

The documentation is confusing regarding the use of config parameters in target definitions. I had to read through the python code to discover the necessary key was overrides and not target_overrides. The documentation should probably be updated to include more information on this. This is being recified in ARMmbed/mbed-os-5-docs#398

@mbed-ci
Copy link

mbed-ci commented Jan 20, 2018

Automatic CI verification build not done, please verify manually.

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 22, 2018

The documentation is confusing regarding the use of config parameters in target definitions. I had to read through the python code to discover the necessary key was overrides and not target_overrides. The documentation should probably be updated to include more information on this

Is this in the docs portal? Can you file the bug in https://github.com/ARMmbed/Handbook ?

confirmed to work on target hardware

How did you test ? Does this have on board debugger that could be supported by greentea to run our tests?

@drewcassidy
Copy link
Contributor Author

I already made a fork of the handbook with the intent of doing a pull request but just caught a cold and havnt gotten around to it yet

I tested with just blinky, it should be identical to any other nrf51822 board besides the LF clock source and pin names

@drewcassidy
Copy link
Contributor Author

drewcassidy commented Jan 22, 2018

I attempted to test the board using Greentea, but it wont work because it relies on the MSD programming. Theres no DAPLink version for the lpc11u35 in my programmer that directly supports the nrf51822, so resetting doesnt work, and i'm having trouble getting greentea working with pyOCD (see ARMmbed/greentea#259)

@drewcassidy
Copy link
Contributor Author

After some firmware changes and connecting the UART to the programmer (which I didnt realize greentea needed) I ran all the tests

all tests pass except mbed_drivers-ticker: 2x callbacks, probably due to the decreased clock resolution when using the RC timer

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 23, 2018

all tests pass except mbed_drivers-ticker: 2x callbacks, probably due to the decreased clock resolution when using the RC timer

Can you provide logs (-v verbose output) to understand the failure better? The test should be fixed or target :)

@drewcassidy
Copy link
Contributor Author

the test times out, and is reported as an error

[1516696965.48][CONN][RXD] >>> Running case #11: 'Test timers: 2x callbacks'...
[1516696965.54][CONN][INF] found KV pair in stream: {{__testcase_start;Test timers: 2x callbacks}}, queued...
[1516696965.57][CONN][INF] found KV pair in stream: {{timing_drift_check_start;0}}, queued...
[1516696965.58][SERI][TXD] {{base_time;0}}
[1516697190.20][HTST][INF] test suite run finished after 240.64 sec...

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 23, 2018

How to reproduce? using any nrf5x target? Tests should be green

@drewcassidy
Copy link
Contributor Author

Any nRF51 target using the RC low frequency clock should probably reproduce it yeah. I’ll try testing it outside Greentea after class today

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 24, 2018

Any nRF51 target using the RC low frequency clock should probably reproduce it yeah. I’ll try testing it outside Greentea after class today

Let us know your findings. All tests should be green

@drewcassidy
Copy link
Contributor Author

I connected a 32KHz watch crystal to it in a breadboard, making it more or less identical to the configuration of an NRF51-DK, and the test fails with the same error. If anyone could run mbed test -n mbed-os-tests-mbed_drivers-ticker with another nRF51-based board and report back that would be helpful, but I'm starting to suspect this is an unrelated issue.

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 25, 2018

I connected a 32KHz watch crystal to it in a breadboard, making it more or less identical to the configuration of an NRF51-DK, and the test fails with the same error. If anyone could run mbed test -n mbed-os-tests-mbed_drivers-ticker with another nRF51-based board and report back that would be helpful, but I'm starting to suspect this is an unrelated issue.

@mprse @maciejbocianski Can you please look at this test issue?

@mprse
Copy link
Contributor

mprse commented Jan 25, 2018

Hi,
I noticed that OSHChip:master branch is not up to date.

Recently synchronisation fix was provided to ticker HAL layer. Please check the following PR: #5889. This might be related to your issue (see tests results).

Please rebase OSHChip:master on the current master and try again.

@drewcassidy drewcassidy force-pushed the master branch 2 times, most recently from 81af684 to f4a5f00 Compare January 25, 2018 16:23
@drewcassidy
Copy link
Contributor Author

drewcassidy commented Jan 25, 2018

After rebasing, the test doesnt compile at all. It looks like aaa15bc changed the test file but I'm not sure how its getting into RTOS stuff

$ mbed test -c -v --compile -n mbed-os-tests-mbed_drivers-ticker
>>SNIP<<
        Compile [ 66.6%]: mbed_rtx_idle.cpp
        [DEBUG] Compile: arm-none-eabi-g++ -std=gnu++98 -fno-rtti -Wvla -c -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fmessage-length=0 -fno-exceptions -fno-builtin -ffunction-sections -fdata-sections -funsigned-char -MMD -fno-delete-null-pointer-checks -fomit-frame-pointer -Os -g1 -mcpu=cortex-m0 -mthumb -D__CORTEX_M0 -DNRF51 -D__MBED__=1 -DTARGET_LIKE_MBED -DTARGET_NRF51822 -DDEVICE_PORTINOUT=1 -D__MBED_CMSIS_RTOS_CM -DMBED_BUILD_TIMESTAMP=1516902332.91 -DTOOLCHAIN_object -D__CMSIS_RTOS -DTARGET_MCU_NRF51822_UNIFIED -DTOOLCHAIN_GCC -DTARGET_CORTEX_M -DTARGET_SDK11 -DARM_MATH_CM0 -DTARGET_UVISOR_UNSUPPORTED -DTARGET_NRF5 -DFEATURE_BLE=1 -DTARGET_M0 -DTARGET_MCU_NRF51 -DCMSIS_VECTAB_VIRTUAL -DTARGET_MCU_NRF51_UNIFIED -DMBED_TICKLESS -DDEVICE_INTERRUPTIN=1 -DTARGET_CORTEX -DDEVICE_I2C=1 -DDEVICE_PORTOUT=1 -DTARGET_RELEASE -DTARGET_NORDIC -DDEVICE_SERIAL=1 -DBLE_STACK_SUPPORT_REQD -DTARGET_MCU_NRF51_32K_UNIFIED -DDEVICE_PORTIN=1 -DDEVICE_SLEEP=1 -DTOOLCHAIN_GCC_ARM -DTARGET_MCU_NRF51822 -DTARGET_MCU_NORDIC_32K -DSOFTDEVICE_PRESENT -DNO_SYSTICK -DDEVICE_SPI=1 -DCMSIS_VECTAB_VIRTUAL_HEADER_FILE="cmsis_nvic.h" -DDEVICE_SPISLAVE=1 -DDEVICE_ANALOGIN=1 -DDEVICE_PWMOUT=1 -DS130 -DTARGET_OSHCHIP -DTARGET_LIKE_CORTEX_M0 -DTARGET_MCU_NRF51_32K @/Users/drewcassidy/Projects/OSHChip-mbed-tests/BUILD/tests/OSHChip/GCC_ARM/.includes_bb1986b19ee2954951aa1bc2a56ce774.txt -include /Users/drewcassidy/Projects/OSHChip-mbed-tests/BUILD/tests/OSHChip/GCC_ARM/mbed_config.h -MD -MF BUILD/tests/OSHChip/GCC_ARM/mbed-os/rtos/TARGET_CORTEX/mbed_rtx_idle.d -o BUILD/tests/OSHChip/GCC_ARM/mbed-os/rtos/TARGET_CORTEX/mbed_rtx_idle.o /Users/drewcassidy/Projects/OSHChip-mbed-tests/mbed-os/rtos/TARGET_CORTEX/mbed_rtx_idle.cpp
        [Error] mbed_rtx_idle.cpp@50,29: 'get_lp_ticker_data' was not declared in this scope
        [DEBUG] Return: 1
        [DEBUG] Output: /Users/drewcassidy/Projects/OSHChip-mbed-tests/mbed-os/rtos/TARGET_CORTEX/mbed_rtx_idle.cpp: In constructor 'RtosTimer::RtosTimer()':
        [DEBUG] Output: /Users/drewcassidy/Projects/OSHChip-mbed-tests/mbed-os/rtos/TARGET_CORTEX/mbed_rtx_idle.cpp:50:29: error: 'get_lp_ticker_data' was not declared in this scope
        [DEBUG] Output:      RtosTimer(): TimerEvent(get_lp_ticker_data()), _start_time(0), _tick(0) {
        [DEBUG] Output:                              ^~~~~~~~~~~~~~~~~~
        [DEBUG] Output: /Users/drewcassidy/Projects/OSHChip-mbed-tests/mbed-os/rtos/TARGET_CORTEX/mbed_rtx_idle.cpp:50:29: note: suggested alternative: 'get_us_ticker_data'
        [DEBUG] Output:      RtosTimer(): TimerEvent(get_lp_ticker_data()), _start_time(0), _tick(0) {
        [DEBUG] Output:                              ^~~~~~~~~~~~~~~~~~
        [DEBUG] Output:                              get_us_ticker_data

[mbed] ERROR: "/usr/bin/python" returned error code 1.
[mbed] ERROR: Command "/usr/bin/python -u /Users/drewcassidy/Projects/OSHChip-mbed-tests/mbed-os/tools/test.py -t GCC_ARM -m OSHChip --source /Users/drewcassidy/Projects/OSHChip-mbed-tests --build /Users/drewcassidy/Projects/OSHChip-mbed-tests/BUILD/tests/OSHChip/GCC_ARM --test-spec /Users/drewcassidy/Projects/OSHChip-mbed-tests/BUILD/tests/OSHChip/GCC_ARM/test_spec.json -n mbed-os-tests-mbed_drivers-ticker -v" in "/Users/drewcassidy/Projects/OSHChip-mbed-tests"
---

@mprse
Copy link
Contributor

mprse commented Jan 25, 2018

Looks like LOWPOWERTIMER is not available. If this feature is available for your device, then try to add LOWPOWERTIMER to target's device_has array in targets.json file. Otherwise try to disable tickless mode.

@drewcassidy
Copy link
Contributor Author

drewcassidy commented Jan 25, 2018

Even after rebasing the issues with the 2x callbacks test remains. This happens regardless of the LF clock source The tests now pass when using a crystal, but time out when using the internal RC

I'm unclear on what this test is actually supposed to do?

@mprse
Copy link
Contributor

mprse commented Jan 26, 2018

What is the frequency of the internal clock? It looks like you still need to adjust clock frequency to your board. NRF51_DK clock frequency is defined here:

#define RTC_INPUT_FREQ 32768 /**< Input frequency of the RTC instance. */

@drewcassidy
Copy link
Contributor Author

drewcassidy commented Jan 26, 2018

What is the frequency of the internal clock?

The internal RC clock is the same fequency, 32.768 kHz

I'm unclear on what that test is supposed to be doing, but after looking at it outside greentea it looks like its suffering to a race condition? event 1 starts the ticker for event 2, but event 1 gets called again before event 2 can, resetting its clock, so event 2 never happens, if that makes sense. I dont know what the expected behavior is, but I think this is at least part of the problem

This behavior happened predictably when testing at a lower frequency, but when running with a 1ms period the behavior was erratic, even when using the crystal. I'm assuming its just trying to run too fast for the cortex-m0

the test program I used is here

@drewcassidy
Copy link
Contributor Author

drewcassidy commented Jan 27, 2018

Once I get hold of an nRF51-DK I'll try to test this further and confirm its not specific to the OSHChip hardware. I can no longer get the tests to pass with the crystal, so I think its just very erratic

… should probably move to the unified target at some point but is outside the scope of this PR
@bulislaw
Copy link
Member

bulislaw commented Feb 6, 2018

@drewcassidy can you confirm this board has a working DAPLink?

@drewcassidy
Copy link
Contributor Author

@drewcassidy can you confirm this board has a working DAPLink?

It comes with a DAPLink programmer to connect to it, but the board itself is too small to have one built in

@cmonr
Copy link
Contributor

cmonr commented Feb 12, 2018

@bulislaw What is the reason for the DNM tag?

@bulislaw
Copy link
Member

My question was answered. Removing the DNM tag.

@cmonr
Copy link
Contributor

cmonr commented Feb 13, 2018

/morph build

@drewcassidy
Copy link
Contributor Author

drewcassidy commented Feb 13, 2018

This can be merged, just note that the ticker tests still fail on the nRF51 when using the RC Low Frequency clock. I still have some debugging to do to figure out why, but its not entirely specific to this target.

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 14, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Feb 14, 2018

Build : SUCCESS

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

Triggering tests

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

@mbed-ci
Copy link

mbed-ci commented Feb 14, 2018

@mbed-ci
Copy link

mbed-ci commented Feb 14, 2018

│ SEL D5 ╶┨ 6 └──┘11 ┠╴ D9 AREF
└─ CLK D4 ╶┨ 7 10 ┠╴ A2
GND ╶┨ 8 :: 9 ┠╴ A3
┗━━━━━━━━━━┛
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's some nice ascii art.

@cmonr
Copy link
Contributor

cmonr commented Feb 14, 2018

Merging this in since the issue that causes the ticker problem is non-standard.
Opening up an issue to keep track of the problem (reproduced with a NRF51-DK).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants