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
  Update bootlogo and pinetime-app with OTA/DFU lookin 3 207 11-25-2020, 04:51 PM
Last Post: lookin
Heart wasp-os: MicroPython for PineTime! danielt 84 23,110 11-22-2020, 11:55 AM
Last Post: danielt
  PineTime Simulation Feature gjoyet 3 236 11-15-2020, 11:42 AM
Last Post: gjoyet
  Star Trek computer themed wasp-os on PineTime graynada 11 1,852 10-30-2020, 01:00 PM
Last Post: graynada
  Pinetime and P8 Integration testing framework maiden 7 1,013 10-23-2020, 03:25 PM
Last Post: maiden
  Article: Create Your Own PineTime Watch Face in Rust... And Publish on crates.io lupyuen 2 445 10-18-2020, 09:24 PM
Last Post: lupyuen
  Article: Bluetooth Time Sync and LVGL on PineTime Mynewt lupyuen 0 263 10-15-2020, 05:51 PM
Last Post: lupyuen
  Remote PineTime for flashing and testing firmware remotely lupyuen 5 662 10-06-2020, 12:03 AM
Last Post: lupyuen
  Rust on PineTime at RIOT Summit lupyuen 3 895 09-25-2020, 05:05 PM
Last Post: lupyuen
  Article: Preview PineTime Watch Faces in your Web Browser with WebAssembly lupyuen 1 591 09-13-2020, 02:09 PM
Last Post: VMMainFrame

Forum Jump:


Users browsing this thread: 1 Guest(s)