<?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>Flashing nRF51 with OpenOCD on Raspberry Pi</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/21650/flashing-nrf51-with-openocd-on-raspberry-pi</link><description>On our project we&amp;#39;re using a Raspberry Pi 3 compute module with custom hardware and 2x nRF51 SoC running HCI from Zephyr. 
 We&amp;#39;ll be delivering more than 150 of those devices, that means more than 300 nRF51 and flashing each one of them manually is boring</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 17 Jul 2017 09:30:43 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/21650/flashing-nrf51-with-openocd-on-raspberry-pi" /><item><title>RE: Flashing nRF51 with OpenOCD on Raspberry Pi</title><link>https://devzone.nordicsemi.com/thread/84974?ContentTypeID=1</link><pubDate>Mon, 17 Jul 2017 09:30:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f5d4e9a4-8502-4254-8cdc-fb39180e3194</guid><dc:creator>Ronaldo Pace</dc:creator><description>&lt;p&gt;The pointer to fix this was from the question I posted on StackOverflow:
&lt;a href="https://stackoverflow.com/a/43777549/906362"&gt;stackoverflow.com/.../906362&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The main point was to adjust it to the right speed coefficient for the PI 3. That means, for other PIs you&amp;#39;ll have to adjust coeffs and peripheral base, as per table:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; # Raspi2 and Raspi3 peripheral_base address
 bcm2835gpio_peripheral_base 0x3F000000
 
 # Raspi1 peripheral_base address
 bcm2835gpio_peripheral_base 0x20000000
 
 # Raspi3 BCM2837 (1200Mhz): 
 bcm2835gpio_speed_coeffs 194938 48
 
 # Raspi2 BCM2836 (900Mhz):
 bcm2835gpio_speed_coeffs 146203 36
 
 # Raspi1 BCM2835: (700Mhz)
 bcm2835gpio_speed_coeffs 113714 28
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We have several OpenOCD cfg script files (to execute flash, erase, reset or check status on the nRF51 connected on pins 20,21 and on pins 30, 31). Below is one of the scripts:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; # pi interface
 interface bcm2835gpio
 bcm2835gpio_peripheral_base 0x3F000000
 bcm2835gpio_swd_nums 20 21
 bcm2835gpio_speed_coeffs 194938 48
 bcm2835gpio_srst_num 18
 reset_config srst_only srst_push_pull
 
 # transport
 transport select swd
 
 # target
 set WORKAREASIZE 0
 set CHIPNAME nrf51822
 source [find target/nrf51.cfg]
 reset_config srst_only srst_nogate
 adapter_nsrst_delay 100
 adapter_nsrst_assert_width 100
 
 # execution
 init
 targets
 halt
 nrf51 mass_erase
 flash write_image &amp;lt;full_file_path&amp;gt;.hex 0
 reset halt
 targets
 verify_image &amp;lt;full_file_path&amp;gt;.hex 0
 reset run
 targets
 exit
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flashing nRF51 with OpenOCD on Raspberry Pi</title><link>https://devzone.nordicsemi.com/thread/84973?ContentTypeID=1</link><pubDate>Mon, 17 Jul 2017 09:23:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aa18c66a-4bb9-4fd0-bbe9-c635df90518d</guid><dc:creator>Ronaldo Pace</dc:creator><description>&lt;p&gt;Hi. Yes I did. I&amp;#39;ll write it as an answer now.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flashing nRF51 with OpenOCD on Raspberry Pi</title><link>https://devzone.nordicsemi.com/thread/84972?ContentTypeID=1</link><pubDate>Sun, 16 Jul 2017 12:58:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f91d7e37-5ffe-4f0e-a215-744deb95afdd</guid><dc:creator>Shay Ohayon</dc:creator><description>&lt;p&gt;Did you figure this one out?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>