XM122 XB122 prototyping

Hi new to this, so excuse the elementary question

Can I put custom software on a XM122 using the XB122 dev kit?
This is the only hardware I have, is nRFUtil my only option to push software to the XM122?  Seems like the other tools need different dev boards or debugger interfaces.
If so, what is the best tool to build new hex files on a Windows platform, and some pointer to a sample of doing this?

Thanks

Cheers

Andreas

Parents
  • Hi there,

    Can I put custom software on a XM122 using the XB122 dev kit?

    This is an external third party module, but as far as I can see it has a nRF52840 which has a SWD debug interface that can be used to flash fw. I'm not sure if the devkit you're referring to has an on board debugger that can be used to flash external boards (It doesn't look like it). Either way, you could use a stand alone J-link debugger from SEGGER to flash the XM122 as long the SWD interface has been routed out. 

    regards
    Jared

  • Hi Jared,

    Thanks for the prompt reply, I made some progress, but stuck again.  After lots of reading and downloading, I have now picked all the tools to be used, and all steps working, except the actual DFU flashing (which now also works, but BLE not advertising).

    Toolset:

    SEGGER Embedded Studio for ARM Release 6.34a Build 2022083102.51023 Windows x64

    Python 3.7

    nrfutil - latest version 6.1.6

    mergehex - latest version 10.17.3

    nRF5_SDK_15.3.0_59ac345

    Sample App acconeer_xm122_v2_11_0.zip

    Sample project segger_embedded_studio.emProject

    The project compiles after fixing the issue as explained in  undefined reference to `__RAM1_segment_end__' 

    I changed the link settings to add a .hex file as output, also seems successful

    I thengenerated the settings.hex with:

    nrfutil settings generate --family NRF52 --application acc_bluetooth_beacon.hex --application-version 1 --bootloader-version 2 --bl-settings-version 1 settings.hex

    Then merged settings with app with:

    mergehex -m acc_bluetooth_beacon.hex settings.hex -o merged.hex

    Then added what seems to be the appropriate softdevice with:

    mergehex -m merged.hex s140_nrf52_6.1.1_softdevice.hex -o merged_output.hex

    Then generated the deployment package with:

    nrfutil pkg generate --hw-version 52 --application-version 1 --application merged_output.hex --sd-req 0xB6 --sd-id 0xB6 app_dfu_package.zip

    All seems fine.  But when I try to deploy package to XM122 via XB122 and nRF Toolbox DFU app, the process fails after Bootloader Enabled - ok

    Initializing DFU - fail

    Ok, now for the catch, I was repeating these steps as I was typing and this time it worked, no fail on DFU Init.  BUT when I reset the XB-/XM122 I do not see any BLE advertisements as expected, I do not even see the device.

    Any advice on how to debug this will be appreciated.

    Thanks

    Cheers

    Andreas

  • Hi Andreas,

    Likely, your bootloader has support for BLE integrated.

    But I think I have figured out what have gone wrong here.
    From "nrfutil pkg generate --help":

    "--softdevice TEXT The SoftDevice firmware file."

    So to add a softdevice to the image, you must tag it as a soft-device.

    You meged it into the application with:

    AndreasLiebenberg said:
    mergehex -m merged.hex s140_nrf52_6.1.1_softdevice.hex -o merged_output.hex

    Because of this, nrfutil does not know that this is a softdevice, and may have written it to the wrong place in flash.
    Therefore, the bootloader can no longer access the softdevice to do BLE.

    However, as you said, you can do dfu over serial, right?

    AndreasLiebenberg said:
    nrfutil dfu serial -pkg bluetooth_demo_app_xm122.zip -p COM5

    In this case, try to generate a new zip file for DFU using the --softdevice. See nRF52840 Dongle Programming Tutorial  for how to use nrfutil properly.

    Regards,
    Sigurd Hellesvik

  • Thanks Sigurd,

    I will look into this in more detail.  No, unfortunately I cannot DFU Serial anymore, it cannot connect to COM5, probably caused by the same issue.  As I understand J-link is now my only option?

    Thanks

    Cheers

    Andreas

  • Hi Andreas,

    Yes, if it looks like the bootloader is broken, a debugger is the only option.

    You can use a J-Link as you say.

    Another alternative is to use any of our nRF Developement Kits, as they come with a debugger on board, and are able to program external chips.
    For example the nRF52840DK.

    Regards,
    Sigurd Hellesvik

  • Hi Sigurd,

    Thanks nRF52840DK did the trick. I used the 10pin Cable connected to Debug Out on the nRF52840 DK and the SWD/JTAG on the XB122. To solve the power supply I shorted the SB47 on the nRF52840 DK which gave the XB122 power through the debug interface and prevents me from updating the nRF52840 DK itself. I could deploy the bootloader using commands":
    nrfjprog -f nrf52 --erasepage 0xFE000-0x100000
    nrfjprog -f nrf52 --program production_sw.hex --sectorerase --verify
    nrfjprog -f nrf52 --reset

    And the could load the supplied S140_nRF52.6.1.1_Softdevice.hex

    After that I could reload old samples and device is functioning normal.

    This put me back on deploying my own App.  I followed your advice and used the command

    nrfutil pkg generate --hw-version 52 --application-version 1 --application acc_bluetooth_beacon.hex --softdevice s140_nrf52_6.1.1_softdevice.hex --sd-req 0xB6 --sd-id 0xB6 app_dfu_package.zip

    which included the --softdevice setting.  This managed to deploy and I can redeploy, so the alignment and combination of the .hex files seems fine.  Thanks!

    I do now have a next problem, the sample now fails in the create_envelope_service() function.

    service_handle = acc_service_create(envelope_configuration); returns a NULL handle, all up to this point looked fine...

    The errors in the debug window shows:

    "<error> app: sensor_protocol:Timeout waiting for event on sensor 1
    <error> app: cpd_cbank_and_vana_calibration:Failed to get result for vana setting=0
    <error> app: cpd_cbank_and_vana_calibration:Get Vana result failed
    <error> app: sensor_manager:Calibration failure for sensor 1
    <info> app: Could not create envelope service"

    Any idea where to start looking for this next problem?

    Thanks

    Cheers

    Andreas

  • Hi Andreas,

    Nice to hear that you were able to solve your problem, good job!

    AndreasLiebenberg said:
    I do now have a next problem

    Could you create a new ticket for this new problem?
    It would help us keep DevZone tidy, and easier for other users to find solutions later.

    Regards,
    Sigurd Hellesvik

Reply Children
No Data
Related