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 InfiniTime, the FOSS firmware for the PineTime: https://github.com/InfiniTimeOrg/InfiniTime

Mastodon : https://mastodon.codingfield.com/@JF
Twitter : https://twitter.com/codingfield
Matrix : @JF002:matrix.org
#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 :-)
#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 InfiniTime, the FOSS firmware for the PineTime: https://github.com/InfiniTimeOrg/InfiniTime

Mastodon : https://mastodon.codingfield.com/@JF
Twitter : https://twitter.com/codingfield
Matrix : @JF002:matrix.org
#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.
#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 InfiniTime, the FOSS firmware for the PineTime: https://github.com/InfiniTimeOrg/InfiniTime

Mastodon : https://mastodon.codingfield.com/@JF
Twitter : https://twitter.com/codingfield
Matrix : @JF002:matrix.org
#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.
#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.
#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.
#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


Possibly Related Threads…
Thread Author Replies Views Last Post
  Develop a new firmware for PineTime belushi 2 1,282 09-25-2023, 12:32 PM
Last Post: ccchan234
  Bluetooth BLE-MIDI-controller app for PineTime / InfiniTime Luno 0 497 08-20-2023, 05:17 AM
Last Post: Luno
  Zephyr Backlight Examples for PineTime lcj 0 690 05-06-2023, 02:54 PM
Last Post: lcj
  Zephyr is ready for pinetime jandy 1 2,074 05-06-2023, 02:15 PM
Last Post: lcj
  Send a message from Android to pinetime via BLE razrosman 0 905 11-05-2022, 08:24 AM
Last Post: razrosman
  PineTime Stuck in DFU Mode Eesha Barua 1 1,997 07-25-2022, 09:17 PM
Last Post: heyhewmike
  Idle tracking with PineTime: how versatile it is? schaman 1 1,607 07-13-2022, 12:50 AM
Last Post: wibble
  PineTime implemented with partial of pebble API jandy 0 1,534 03-20-2022, 08:58 PM
Last Post: jandy
  "Pine64 USB JTAG Adapter + OpenOCD + PineTime" should it work? ITCactus 4 3,870 03-02-2022, 05:58 AM
Last Post: wibble
  Zephyr based Pinetime jandy 4 4,630 11-11-2021, 05:53 AM
Last Post: jandy

Forum Jump:


Users browsing this thread: 3 Guest(s)