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
Matrix : @JF002atrix.org
  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
Matrix : @JF002atrix.org
  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
Matrix : @JF002atrix.org
  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
Heart wasp-os: MicroPython for PineTime! danielt 38 2,628 3 hours ago
Last Post: danielt
  Article: Porting MicroPython and wasp-os to Mynewt on PineTime lupyuen 0 23 06-03-2020, 07:07 PM
Last Post: lupyuen
  Article: Wireless Firmware Update In Action on PineTime lupyuen 0 52 05-20-2020, 06:03 AM
Last Post: lupyuen
  MCUBoot Bootloader for PineTime lupyuen 2 294 05-18-2020, 04:23 PM
Last Post: lupyuen
  Simplified boot flasher for PineTime via PI jlukanc 0 43 05-15-2020, 04:38 PM
Last Post: jlukanc
  PineTime Hypnos endian-albin 0 99 05-10-2020, 02:28 AM
Last Post: endian-albin
  CHIP-8 Retro Game Emulator for PineTime lupyuen 7 503 04-15-2020, 12:19 PM
Last Post: seclorum
  wasp-bootloader: a robust SoftDevice bootloader for PineTime danielt 3 525 04-14-2020, 05:31 AM
Last Post: danielt
  Pinetime backlight current. TT-392 2 238 03-11-2020, 09:57 AM
Last Post: TT-392
  Create PineTime Watch Apps with Visual Rust lupyuen 0 174 02-19-2020, 02:50 AM
Last Post: lupyuen

Forum Jump:


Users browsing this thread: 1 Guest(s)