This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to simulate button press via SWD?

Hi.

I flash a board with NRF51822 via SWD pads, and that way the push button is inaccessible, and I need to press it to test various functions. Push button is on 28 bit and signal led is on 29.
I'm able to read from memory when button is released and when is pressed with OpenOCD (or Jlink if it would be better):

> nrf51.cpu mdw 0x50000510
0x50000510 10000000 ....

> nrf51.cpu mdw 0x50000510
0x50000510 00000000 ....

But, of course, writing to the register would not help:

nrf51.cpu mww 0x50000504 0x00000000

That way I'm only able to turn off\on led.

I need to figure out something software here, since there are 200 more of those board to flash and test...

Parents
  • Well, I managed to emulate button press setting pull-down resistor for a button, and release setting pull-up. Don't know why didn't manage it before, perhaps OpenOCD deals with memory slightly different than Jlink.



    Register addresses one can easily find in chip reference manual. Pull-down value here is 0x30004, and pull-up is 0x3000c.

    The only strange thing is that during sleep, pull-down setting is quickly removed. So I needed to set it several times in a row to be able to "press" it.

Reply
  • Well, I managed to emulate button press setting pull-down resistor for a button, and release setting pull-up. Don't know why didn't manage it before, perhaps OpenOCD deals with memory slightly different than Jlink.



    Register addresses one can easily find in chip reference manual. Pull-down value here is 0x30004, and pull-up is 0x3000c.

    The only strange thing is that during sleep, pull-down setting is quickly removed. So I needed to set it several times in a row to be able to "press" it.

Children
No Data
Related