# 9P9215 NETOS Bootloader modification advice

**URL:** <https://forums.digi.com/t/9p9215-netos-bootloader-modification-advice/16172>\
**Category:** Embedded Devices\
**Tags:** bootloader, gpio\
**Created:** [January 29, 2016, 4:00pm UTC](https://forums.digi.com/t/9p9215-netos-bootloader-modification-advice/16172 "2016-01-29T16:00:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![marzahld](https://avatars.discourse-cdn.com/v4/letter/m/dc4da7/32.png) [@marzahld](https://forums.digi.com/u/marzahld)\
**Post date:** [January 29, 2016, 4:00pm UTC](https://forums.digi.com/t/9p9215-netos-bootloader-modification-advice/16172/1 "2016-01-29T16:00:48Z")

</div>

We are pretty much using the stock 7.5.2 bootloader with a small modification to “customizeSetupCS0(void);” for our fpga mapping.

I want to move the recovery bootloader (TFTP) force input switch from GPIO4 to GPIO69 by altering “customizeIsImageDownloadForced()” in “customizeBootloader.c”. I am successful in moving it to some lower GPIO #'s such as GPIO1, but for some reason I can’t get it to work at GPIO69. This GPIO69 access code works fine when used in the app image, but not in the bootloader. I even tried using narm\_read\_reg primitives to configure and read this gpio directly and it still wont work. Is there anything that can override gpio pins from configuration & reading that I can check?

---

<div class="post-metadata">

**Author:** ![LeonidM](https://avatars.discourse-cdn.com/v4/letter/l/d26b3c/32.png) [@LeonidM](https://forums.digi.com/u/LeonidM)\
**Post date:** [March 3, 2016, 5:46am UTC](https://forums.digi.com/t/9p9215-netos-bootloader-modification-advice/16172/2 "2016-03-03T05:46:29Z")

</div>

This should work. There is nothing special connected to GPIO[69]  
Try using simple\_serial driver annd bsp\_printf() function to print register values. Set the GPIO register values explicitly, then read them back. Compare to working values in your application. It should be set as input by default:  
#define BSP\_GPIO\_INITIAL\_STATE\_PIN69 BSP\_GPIO\_INITIAL\_STATE\_INPUT\_RECEIVER

---

<div class="post-metadata">

**Author:** ![marzahld](https://avatars.discourse-cdn.com/v4/letter/m/dc4da7/32.png) [@marzahld](https://forums.digi.com/u/marzahld)\
**Post date:** [March 30, 2016, 1:36pm UTC](https://forums.digi.com/t/9p9215-netos-bootloader-modification-advice/16172/3 "2016-03-30T13:36:38Z")

</div>

I fixed it! The problem was that even though I had it set as an INPUT in gpio.h as stated by Leonid, it is _not enough_ to do this:

#define BSP\_GPIO\_INITIAL\_STATE\_PIN69 BSP\_GPIO\_INITIAL\_STATE\_INPUT\_RECEIVER

Additionally, you must also change the Digi IOP MUX defaults from USE\_2ND\_PATH, to INTERNAL USE. I’m unsure of what consequences could come from changing these Digi defaults for the 9p9215. So far I have not found any. They may have been set this way for something that was part of the 9p9215’s eval board? I think I am going to set all of mine to internal only in the event this could be causing some other issues.

//#define BSP\_GPIO\_MUX\_IOP\_0\_GEN\_IO\_1 BSP\_GPIO\_MUX\_USE\_2ND\_ALTERNATE\_PATH  
#define BSP\_GPIO\_MUX\_IOP\_0\_GEN\_IO\_1 BSP\_GPIO\_MUX\_INTERNAL\_USE\_ONLY

Alternatively you _can_ reconfigure the pin in your own code. The reason it didn’t work for me the first time, is that a neighboring pin which should have also been INPUT was also suffering from the same IOP MUX issue causing my pin 69 input to be pulled in the wrong direction.

Hope this helps someone else.
