Forum Libraries, Components, and Plugins

Porting Nordic BLE DFU FOTA to Xamarin

2»

Posts

  • AugustBeringAugustBering SEMember

    Hi guys, any new updates on this? Just starting to look at DFU for my project http://freedrum.rocks

  • ShayOhayonShayOhayon USMember ✭✭✭

    The freedrum looks like an awesome project. I'd love to get my hands on one.
    I got FOTA to work to some degree. It depends on which mbed OS / sdk you are using.
    The current code doesn't support zip file upload or signing. If you have time to work on such features, it would be great to improve the current implementation.
    I've modified the original code a bit. It now supports early (mbed OS 2) support for "old" bootloaders. It is based on "Plugin.BLE", which is freely available.
    Too bad Nordic doesn't support Xamarin officially. They recently updated their Android and iOS code base to support code signing.

  • Ajay_SBSICAjay_SBSIC USMember ✭✭✭

    Hello, Anyone have idea , How to Bind Nordic DFU Library in Xamarin.IOS. Or Any refernce code?

  • emw1909emw1909 USMember

    Hi Everyone,

    Was wondering if a github site with this project was every created? I am looking for a way to perform DFU only on Nordic nrf52 device from Xamarin for iOS and Android.

    Thanks.

  • ShayOhayonShayOhayon USMember ✭✭✭

    @emw1909, look up. I posted code. I use it to update nrf52 as well.

  • emw1909emw1909 USMember

    Thank you very much! I take it the code is using the Plugin.BLE project instead of the Arendi libraries?

  • ShayOhayonShayOhayon USMember ✭✭✭
  • jason2lijason2li USMember
    edited October 2017

    Hey everybody, I'm new to this thread (and Xamarin, and DFU, etc), but this looks awesome so far. Thanks to those who've put the time into this!

    I'm currently stuck, though. I'm trying:

    byte[] softDevice = null;
    byte[] bootloader = null;
    byte[] application = GetFile(); // This gets a .bin file to use (I've tried a .hex file too)
    
    dfuController.UpdateAsync(device, softDevice, bootloader, application)
    

    But it never seems to connect to the device. It always times out with the error:

    DfuFailure.MissingAcknowledged

    I am assuming this is happening because we are currently signing our file. Could that be correct?

    Either way, any guidance would be appreciated.

  • tamtltamtl VNMember

    hi @ShayOhayon , have you updated your source code to read firmware in zip format ? it will be great if you done with that.

  • ShayOhayonShayOhayon USMember ✭✭✭

    @tamtl , no - we now read the new hex directly from our server, so there is no need for a zip file.

  • AbhishekYadavAbhishekYadav USMember
    edited November 2017

    Guys I have accesses the DFU mode Without Binding. But Stuck in Sending Data. Any Idea about Firmware Sending.

  • jtthjtth Member ✭✭

    @ShayOhayon said:
    The freedrum looks like an awesome project. I'd love to get my hands on one.
    I got FOTA to work to some degree. It depends on which mbed OS / sdk you are using.
    The current code doesn't support zip file upload or signing. If you have time to work on such features, it would be great to improve the current implementation.
    I've modified the original code a bit. It now supports early (mbed OS 2) support for "old" bootloaders. It is based on "Plugin.BLE", which is freely available.
    Too bad Nordic doesn't support Xamarin officially. They recently updated their Android and iOS code base to support code signing.

    @ShayOhayon Is this importable and usable in a Xamarin.iOS project?

  • KlynkKlynk Member ✭✭
    edited May 2018

    Hello, managed to get DFU working for both Android and iOS.
    Thought I'd share something back to the community.

    DFU Android:

    github.com/Klynk/Xamarin.DFU.Android/

    DFU iOS (Must be compiled on a mac, not on a remote mac):
    github.com/Klynk/Xamarin.DFU.iOS/

    NuGet Dependencies iOS:

    • Xamarin.Swift4.Core
    • Xamarin.Swift4.CoreFoundation
    • Xamarin.Swift4.CoreGraphics
    • Xamarin.Swift4.CoreImage
    • Xamarin.Swift4.Darwin
    • Xamarin.Swift4.Dispatch
    • Xamarin.Swift4.Foundation
    • Xamarin.Swift4.Metal
    • Xamarin.Swift4.ObjectiveC
    • Xamarin.Swift4.OS
    • Xamarin.Swift4.QuartzCore
    • Xamarin.Swift4.UIKit

    If you are only interested in the pre-compiled dll files, you will find them here:
    mediafire.com/file/fv3doghttc2z3ij/Xamarin.DFU.zip

    I do not have time to make any PCL interface right now, will maybe do it in the future.
    (I just made this account, so I cannot post full links yet.)

  • HentzeHentze Member ✭✭

    Hi all,

    Nice work.

    Is there a Xamarin library that works for Android and iOS.

    Best Regards
    Ragnar

  • KlynkKlynk Member ✭✭
    edited May 2018

    Hello, managed to get DFU working for both Android and iOS.
    Thought I'd share something back to the community.

    DFU Android:
    github.com/Klynk/Xamarin.DFU.Android/

    DFU iOS:
    github.com/Klynk/Xamarin.DFU.iOS/

    Update: just added getting started code to provide some more help.

    (I just made this account, so I cannot post full links yet.)
    (Repost as previous comment got flagged for spam?)

  • KlynkKlynk Member ✭✭

    Sorry, not sure if the company thinks its ok for me to share the binding.
    No idea how to delete a comment.

  • jtthjtth Member ✭✭

    @Klynk said:
    Sorry, not sure if the company thinks its ok for me to share the binding.
    No idea how to delete a comment.

    Hi Klynk,

    The links are down, unfortunately. Any chance you could reupld them? As for Nordic, see link

  • HentzeHentze Member ✭✭

    @Klynk said:
    Sorry, not sure if the company thinks its ok for me to share the binding.
    No idea how to delete a comment.

    HI Klynk,

    What company..?
    I am still stuck in OTA DFU with Xamarin.

  • HentzeHentze Member ✭✭

    Anyone..?:)

  • SanyaAndreichukSanyaAndreichuk USMember ✭✭

    In case anyone need android bindings

  • AhmadFrazAhmadFraz Member ✭✭

    Anyone has found any solution for Xamarin Forms? :smile:

  • MortenLMortenL Member ✭✭
    edited May 2019

    Yes, I have but by using separate bindings project for iOS and Android, then create an interface in the main project.
    A project that included both the iOS and Android bindings and made one unified NuGet package would have been nice. I have limited experience in making NuGet packages so if someone with experience would help out that would be great.

    So if anybody is interested in making/help to make a NuGet I will be glad to contribute with what I know.

  • Hi guys does anyone have a binding for Android they can share. Tried using SanyaAndreichuk binding, but eventually ran into problems finding the gson library that was mentioned by DanielVartdal

  • MortenLMortenL Member ✭✭
    edited October 2019

    @jongchern
    you should be able to use
    https://mvnrepository.com/artifact/com.google.code.gson/gson/2.8.5

    as this is the dependency of the nordic dfu library
    https://github.com/NordicSemiconductor/Android-DFU-Library/blob/release/dfu/build.gradle

    I have two libraries that I got working, most of the time, for iOS and Android. Not sure if I can reproduce put. I am trying to clean up when I get some time. I will share so that the community can update and help improve it.

    Edit:
    Btw, and as a reminder to myself the nordic dfu .aar can also be found in the maven repository
    https://mvnrepository.com/artifact/no.nordicsemi.android/dfu/1.9.0

  • MarkRadacz.7953MarkRadacz.7953 USInsider, University, Developer Group Leader ✭✭

    @SanyaAndreichuk do you have the Android binding compiled for DFU 1.10.1 ?

  • SanyaAndreichukSanyaAndreichuk USMember ✭✭

    @MarkRadacz.7953 unfortunately, I don't have the recent bindings for DFU. But here is the binding project

    https://github.com/sanyandreichuk/Xamarin.DFU

    Maybe you can just simply replace the 'Xamarin.DFU/DFU.Android/Jars/dfu-release.aar' with recent android library and try to build the new binding dll.

  • MarkRadacz.7953MarkRadacz.7953 USInsider, University, Developer Group Leader ✭✭

    Thank you @SanyaAndreichuk !

  • MarkRadacz.7953MarkRadacz.7953 USInsider, University, Developer Group Leader ✭✭

    @SanyaAndreichuk I've run into a problem with the new version (1.10.1) of library, the DfuService has one required override
    for "NotificationTarget" and that needs to be Java class, do you have and idea how to set that up of re-maps it in the
    binding project?

    [Service(Label = "MyDfuService")]
    public class MyDfuService : DfuBaseService
    {
        protected override Class NotificationTarget => typeof(NotificationActivity);
    
        protected override bool IsDebug => base.IsDebug;
    
        protected override void UpdateForegroundNotification(NotificationCompat.Builder p0)
        {
            base.UpdateForegroundNotification(p0);
        }
    }
    
  • SanyaAndreichukSanyaAndreichuk USMember ✭✭

    @MarkRadacz.7953, did you try something like this?

    using Java.Lang;
    
    [Service(Label = "MyDfuService")]
    public class MyDfuService : DfuBaseService
    {
        protected override Class NotificationTarget => Class.FromType(typeof(NotificationActivity));
    
        protected override bool IsDebug => base.IsDebug;
    
        protected override void UpdateForegroundNotification(NotificationCompat.Builder p0)
        {
            base.UpdateForegroundNotification(p0);
        }
    }
    
Sign In or Register to comment.