<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>PYNRFJPROG</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/105395/pynrfjprog</link><description>HI, 
 We have two products that work together. One uses the nrf52832 and the other nrf5340. Using the Programmer (3.0.9) we can take a factory fresh 5340 Erase all and program both network and application cores perfectly. However this is slow. I have</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 25 Sep 2024 10:00:17 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/105395/pynrfjprog" /><item><title>RE: PYNRFJPROG</title><link>https://devzone.nordicsemi.com/thread/503716?ContentTypeID=1</link><pubDate>Wed, 25 Sep 2024 10:00:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ff38c9d6-c566-4251-a555-81145e10a4b5</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;You can use recover():&amp;nbsp;&lt;a href="https://github.com/NordicSemiconductor/pynrfjprog/blob/67e1a1eeaf77566214ea055aed4fd130401ae5a2/pynrfjprog/HighLevel.py#L453"&gt;https://github.com/NordicSemiconductor/pynrfjprog/blob/67e1a1eeaf77566214ea055aed4fd130401ae5a2/pynrfjprog/HighLevel.py#L453&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PYNRFJPROG</title><link>https://devzone.nordicsemi.com/thread/503713?ContentTypeID=1</link><pubDate>Wed, 25 Sep 2024 09:54:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:484ebce2-f741-4078-96c1-cd8386564bc7</guid><dc:creator>rodrigueza</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;What are the steps required to successfully disable readback protection (APPROTECT) for both the application and network core when using the high-level API in the highlevel_program_hex.py example?&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#ffffff;font-size:75%;"&gt;&lt;a style="color:#ffffff;" href="https://geometrydashbreeze.com"&gt;geometry dash breeze&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PYNRFJPROG</title><link>https://devzone.nordicsemi.com/thread/454550?ContentTypeID=1</link><pubDate>Tue, 07 Nov 2023 20:40:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:85e1fb0c-021a-4a96-84a4-5af9b9c09168</guid><dc:creator>finkbr</dc:creator><description>&lt;p&gt;Hi Vidor, That did it!&amp;nbsp; i wasn&amp;#39;t recovering each core separately.&amp;nbsp; Didn&amp;#39;t realize&amp;nbsp; I had to do that.&amp;nbsp; Its all working now and everything is much faster.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PYNRFJPROG</title><link>https://devzone.nordicsemi.com/thread/454399?ContentTypeID=1</link><pubDate>Tue, 07 Nov 2023 10:33:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fe5eddfb-b635-4cc5-9d63-88b5b4fad642</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Brian,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;nbsp;made a test using the &amp;#39;highlevel_program_hex.py&amp;#39; example and discovered that one must specify the CPU core when disabling readback protection (APPROTECT).&amp;nbsp;Please try to disable the readback protection using the high level API as I did here:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="python"&gt;import sys
from pynrfjprog import HighLevel, Parameters


def program_hex(hex_file_path):

    # Initialize an API object.
    # Open the loaded DLL and connect to an emulator probe.
    with HighLevel.API() as api:

        probes = api.get_connected_probes()        
        snr = probes[0]
        # Initialize the probe connection. The device family is automatically detected, and the correct sub dll is loaded.
        with HighLevel.DebugProbe(api, snr) as probe:

            print(&amp;quot;# Reading out device information.&amp;quot;)
            # Read out device information to find out which hex file to program
            device_info = probe.get_device_info()
            print(device_info.device_family)

            # Erase all the flash of the device.
            print(&amp;quot;# Programming %s to device with ERASE_ALL and SYSTEM_RESET.&amp;quot; % hex_file_path)

            # Make a program option struct to modify programming sequence.
            # If ommitted, the default programoptions struct specifies ERASE_ALL, SYSTEM_RESET, and VERIFY_NONE.
            program_options = HighLevel.ProgramOptions(
                erase_action=HighLevel.EraseAction.ERASE_ALL,
                reset=HighLevel.ResetAction.RESET_SYSTEM,
                verify=HighLevel.VerifyAction.VERIFY_READ,
            )

            probe.set_coprocessor(Parameters.CoProcessor.CP_NETWORK)
            if probe.get_readback_protection() != Parameters.ReadbackProtection.NONE:
                print(&amp;quot;Disabling APPROTECT on network core&amp;quot;)
                probe.recover()
            probe.set_coprocessor(Parameters.CoProcessor.CP_APPLICATION)
            if probe.get_readback_protection() != Parameters.ReadbackProtection.NONE:
                probe.recover()
                print(&amp;quot;Disabling APPROTECT on application core&amp;quot;)
            
            probe.program(hex_file_path, program_options=program_options)

            print(&amp;quot;# Application running. &amp;quot;)

    print(&amp;quot;# Example done...&amp;quot;)

def main():
    if len(sys.argv) != 2:
        print(&amp;quot;No .hex file specified&amp;quot;)
        sys.exit(1)
    
    hex_file = sys.argv[1]
    program_hex(hex_file) 


if __name__ == &amp;quot;__main__&amp;quot;:
    main()&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Please also ensure that your pynrfjprog package is up to date (v10.23.2 at the time of writing). This is required if the input hex file contains data for both the application and network core.&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PYNRFJPROG</title><link>https://devzone.nordicsemi.com/thread/454259?ContentTypeID=1</link><pubDate>Mon, 06 Nov 2023 15:09:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:28e4a55c-44d3-4721-bdc4-d0036c59cf02</guid><dc:creator>finkbr</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;As you can see from the above code, I perform a low level recover:&lt;/p&gt;
&lt;p&gt;print(f&amp;quot;The DLL version is: {api.dll_version()}&amp;quot;)&lt;br /&gt; print(f&amp;quot;Erase protect: {api.is_eraseprotect_enabled()}&amp;quot;)&lt;br /&gt; print(&amp;quot;Recovering device&amp;quot;)&lt;br /&gt; api.recover()&lt;br /&gt; print(&amp;quot;Erasing Device&amp;quot;)&lt;br /&gt; api.erase_all()&lt;br /&gt;api.close()&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;But I still cant program the device.&amp;nbsp; &amp;nbsp;I need to be able to permanently disable to protection.&amp;nbsp; When I try from the command line, wit the command you provided, it works fine.&amp;nbsp; we have several steps including serializing the device that the python program takes care of for us.&amp;nbsp; Are you suggesting that i need to write the scripts in a different language because the python nrfjprog doesn&amp;#39;t always work?&amp;nbsp; Or is the lowlevel recover working and the chip is reset to its original state because I close the low level api and open the high level api?&amp;nbsp; If that is the case, can you please tell me how to write a merged.hex using the low level api?&amp;nbsp; The documentation is terrible for the python library.&lt;/p&gt;
&lt;p&gt;I tried using a command shell from python it seems to work but I get these errors in the output:&lt;/p&gt;
&lt;p&gt;[error] [ Client] - Encountered error -90: Command read_memory_descriptors executed for 15 milliseconds with result -90&lt;br /&gt;[error] [ Worker] - Can&amp;#39;t read memory descriptors, ap-protection is enabled.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;However the code IS loaded onto the chip, so why the errors?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Brian&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PYNRFJPROG</title><link>https://devzone.nordicsemi.com/thread/454213?ContentTypeID=1</link><pubDate>Mon, 06 Nov 2023 13:29:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e618af19-1ba1-4dbd-8a4b-4778f1a7fa31</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I would recommend using&amp;nbsp;&lt;a href="https://www.nordicsemi.com/Products/Development-tools/nrf-command-line-tools/download"&gt;nrfjprog&lt;/a&gt; if you are looking for a way to program your nRF devices from the command line or a batch script, but do not necessarily need Python integration.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Flashing&amp;nbsp;chip with nrfjprog when readback&amp;nbsp;protection is enabled&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;$ nrfjprog --program merged_domains.hex --recover --verify  -r&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Flashing chip with nrfjprog when readback protection is&amp;nbsp;disabled&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;pre class="ui-code" data-mode="text"&gt;nrfjprog --program merged_domains.hex --chiperase --verify  -r&lt;/pre&gt;&lt;/strong&gt;&lt;/p&gt;
[quote user=""]An error was reported by NRFJPROG DLL: -90 NOT_AVAILABLE_BECAUSE_PROTECTION.&amp;nbsp;[/quote]
&lt;p&gt;The nRF5340 and&amp;nbsp;nrf52832 with the latest build code (see&amp;nbsp;&lt;a title="IN142 Informational Notice v1.1" href="https://infocenter.nordicsemi.com/pdf/in_142_v1.1.pdf?cp=5_2_2_5"&gt;IN142 Informational Notice v1.1&lt;/a&gt;)&amp;nbsp;have readback protection enabled by default when they leave our factory, which must be disabled before you can perform the initial programming of the chip.&amp;nbsp;When you do an &amp;quot;ERASEALL&amp;quot; in the programmer app, it will perform the same operation as nrfjprog --recover does to unlock the chip. The equivalent function in pynrfjprog&amp;nbsp;is implemented&amp;nbsp;here:&amp;nbsp;&lt;a href="https://github.com/NordicSemiconductor/pynrfjprog/blob/67e1a1eeaf77566214ea055aed4fd130401ae5a2/pynrfjprog/LowLevel.py#L680"&gt;https://github.com/NordicSemiconductor/pynrfjprog/blob/67e1a1eeaf77566214ea055aed4fd130401ae5a2/pynrfjprog/LowLevel.py#L680&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Vidar&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>