PINE64
Create a Stub for PineTime using NRF52-DK - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: PineTime (https://forum.pine64.org/forumdisplay.php?fid=134)
+--- Forum: Development Discussion on PineTime (https://forum.pine64.org/forumdisplay.php?fid=136)
+--- Thread: Create a Stub for PineTime using NRF52-DK (/showthread.php?tid=8673)



Create a Stub for PineTime using NRF52-DK - JF002 - 01-02-2020

Hello,

I've finally managed to build a stub for the PineTime using the NRF52-DK board. This allows me to run the same code on the NRF52-DK and on the actual PineTime HW. There are some limitations (no HR sensor, no vibrator,...) but it allows to do some test, debug and developpment.

I've documented the build in my repo : https://github.com/JF002/Pinetime/blob/master/doc/PinetimeStubWithNrf52DK.md.


Happy hacking Smile


RE: Create a Stub for PineTime using NRF52-DK - lupyuen - 01-02-2020

So cool! :-) That should make test and debug so much easier!

For the Rust + Mynewt OS port I'm taking the low-cost (but more hassle) approach... If we had only a Raspberry Pi, how could we turn it into an SWD Programmer for PineTime? (Or ST-Link, which I'm happily using now)

Thanks for the FreeRTOS port with built-in time sync (Current Time Service)! It was really useful for me to figure out how to implement CTS on the open-source NimBLE stack.

You can see that I'm trying to steer clear of Nordic tools as much as possible :-)


RE: Create a Stub for PineTime using NRF52-DK - JF002 - 01-02-2020

(01-02-2020, 09:57 AM)lupyuen Wrote: So cool! :-) That should make test and debug so much easier!

For the Rust + Mynewt OS port I'm taking the low-cost (but more hassle) approach... If we had only a Raspberry Pi, how could we turn it into an SWD Programmer for PineTime? (Or ST-Link, which I'm happily using now)

Thanks for the FreeRTOS port with built-in time sync (Current Time Service)! It was really useful for me to figure out how to implement CTS on the open-source NimBLE stack.

You can see that I'm trying to steer clear of Nordic tools as much as possible :-)

It's nice that we have different approaches, it'll give more ideas to other developpers!

Implementing the CTS was not easy (perhaps because it was the first time I worked with BLE) but I'm glad it helped you!

Why do you try no to use Nordic tools? Because of closed/open sources? Licences?


RE: Create a Stub for PineTime using NRF52-DK - abdel - 01-03-2020

(01-02-2020, 10:11 AM)JF002 Wrote:
(01-02-2020, 09:57 AM)lupyuen Wrote: So cool! :-) That should make test and debug so much easier!

For the Rust + Mynewt OS port I'm taking the low-cost (but more hassle) approach... If we had only a Raspberry Pi, how could we turn it into an SWD Programmer for PineTime? (Or ST-Link, which I'm happily using now)

Thanks for the FreeRTOS port with built-in time sync (Current Time Service)! It was really useful for me to figure out how to implement CTS on the open-source NimBLE stack.

You can see that I'm trying to steer clear of Nordic tools as much as possible :-)

It's nice that we have different approaches, it'll give more ideas to other developpers!

Implementing the CTS was not easy (perhaps because it was the first time I worked with BLE) but I'm glad it helped you!

Why do you try no to use Nordic tools? Because of closed/open sources? Licences?

If I do understand you have to flah both nordic softdivice FW and your freeRTOS application.
softdevice is not free.
And your freeRTOS application is also not free because of the SDK. I am not sure to understand the SDK license but you are not free to distribute the SDK, and by using SDK functions I dont know what is the implication. (And their SDK is over-complicated.)
Ok, the big advantage is you can get more quickly a working FW,   
But maybe it is not a big deal if we can later remove one by one nordic things.


RE: Create a Stub for PineTime using NRF52-DK - JF002 - 01-03-2020

You are right, the SoftDevice is needed at runtime and the code is based on the SDK from Nordic. Maybe it's not the best for a FOSS software.
But as you said, softdevice and SDK allowed me to quickly write code that works Smile I'm just discovering NRF52 SoC, and starting from scratch would have been much more difficult.


RE: Create a Stub for PineTime using NRF52-DK - lupyuen - 01-03-2020

Yup I'm avoiding Nordic tools because of the cost, specifically, the J-Link programmer. A Raspberry Pi or ST-Link ($2) works just as well and they are much cheaper.

Another reason is that I wanted to use the same tools for nRF52 and STM32 development. So swapping microcontrollers becomes much easier.


RE: Create a Stub for PineTime using NRF52-DK - Mark53 - 01-06-2020

(01-02-2020, 09:57 AM)lupyuen Wrote: If we had only a Raspberry Pi, how could we turn it into an SWD Programmer for PineTime?

Supposedly OpenOCD will let you use the Raspberry Pi GPIO pins for SWD. I say supposedly because that's what I've been trying to do for about a week now and I haven't gotten it to work yet. I'm currently in the process of rebuilding it at v0.9.0 in the hope that a stable version will give me better results than the master branch.


RE: Create a Stub for PineTime using NRF52-DK - Mark53 - 01-07-2020

I don't think I can edit my previous post to add this, but I did get it working yesterday. OpenOCD 0.9.0 wouldn't finish the configuration stage due to jimtcl failing to identify my system type, but the master branch compiled and installed fine. For some reason I couldn't establish a telnet connection from my desktop with OpenOCD running on the Pi, even with an explicit firewall rule to allow telnet connections on my desktop. Installing telnet on the Pi itself and using `screen` to switch between the OpenOCD terminal and the telnet terminal ended up being the solution. I was able to take write protection off of my development kit, but haven't tried flashing anything to it yet.


RE: Create a Stub for PineTime using NRF52-DK - lupyuen - 01-08-2020

Here are the complete instructions for flashing PineTime with a Raspberry Pi. Lemme know if I missed anything :-)

Build and Flash Rust+Mynewt Firmware for PineTime Smart Watch