Create a Stub for PineTime using NRF52-DK
#1
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/m...Nrf52DK.md.


Happy hacking Smile
Working on Pinetime with FreeRTOS (C/C++) : https://github.com/JF002/Pinetime

Mastodon : https://mastodon.codingfield.com/@JF
Twitter : https://twitter.com/codingfield
  Reply
#2
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 :-)
  Reply
#3
(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?
Working on Pinetime with FreeRTOS (C/C++) : https://github.com/JF002/Pinetime

Mastodon : https://mastodon.codingfield.com/@JF
Twitter : https://twitter.com/codingfield
  Reply
#4
(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.
  Reply
#5
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.
Working on Pinetime with FreeRTOS (C/C++) : https://github.com/JF002/Pinetime

Mastodon : https://mastodon.codingfield.com/@JF
Twitter : https://twitter.com/codingfield
  Reply
#6
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.
  Reply
#7
(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.
  Reply
#8
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.
  Reply
#9
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
  Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  wasp-bootloader: a robust SoftDevice bootloader for PineTime danielt 0 107 02-12-2020, 04:58 AM
Last Post: danielt
  Live Debug of RIOT-OS on PineTime lupyuen 3 141 02-11-2020, 06:33 AM
Last Post: wibble
Heart wasp-os: MicroPython for PineTime! danielt 6 275 02-10-2020, 04:00 AM
Last Post: danielt
Lightbulb PineTime Hermes Firmware + Companion App dejvino 5 295 02-01-2020, 03:42 PM
Last Post: dejvino
  PineTime display and micropython danielt 13 433 01-23-2020, 09:11 AM
Last Post: danielt
  PineTime Debugger is now available lupyuen 0 105 01-22-2020, 03:24 AM
Last Post: lupyuen

Forum Jump:


Users browsing this thread: 1 Guest(s)