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

Test nRF51822 through SWD interface after programming (through RTT?)

After programming a panel of 6 modules embedding nRF51822, I would like to send some data in order to test some features. The basic idea is to validate the modules before cutting it from panel and mounting it in its final case. For example, I would like to light a led, start moving motors, etc...

Because I don't have any unused GPIO to use standard UART to do it, I was wondering if it could be possible to send data catchable by the chip trough SWD interface.

I heard about the J-Link RTT feature and it sounds promising, but it seems only possible to read/write register. My need would be to catch the data sent in the code (like with an UART) to execute behavior in order to test physical mounted pieces like motors.

Is it a way to send data to nRF51822 through SWD interface like UART?

Edit

The target of this test is to validate that complex component are well mounted on the PCB. It needs several little screw to make contact on the PCB and is a sensible part of the module. Of course, it is not as simple as toggle a GPIO to test this component because a specific frequency must be generated to test it, so I need to send command to the module to run the test.

  • Assuming the BLE part of the code is working, why not send your live data through BLE instead. You can then activate or deactivate it at will in runtime.

  • Thanks for your answer. It is a good point, but it is too complicated for "mass production" (I mean 6 panels containing 6 modules at times) because the production validation need to be simple and quick driven by a custom software. Also, it involves some masters to establish connections and send data. The bluetooth part is tested in another place in the production line.

  • Ah, I see. I would love to know how this can be resolved. Production QA could be quite a headache.

  • I don't quite understand what test you're trying to do here. Are you trying to test that an LED will come on when the correct GPIO is taken high and a motor will rotate when another one is? Or are you trying to run the software on your board and simulate it into different states, states it would normally get into by some other input, and see if it does the right thing?

    You probably could use RTT for that test, it doesn't just write registers, you can send any data you want and read it by calling the segger RTT input functions in your code in a loop.

    I can't imagine you would want your real code running on the chip to be polling the Segger RTT library, or even initializing it, so you'd want a way early in your code to put the device into a test mode where it loops and reads the RTT input and does your tests, perhaps write a bit pattern into memory somewhere which is tested just after reset to determine whether to boot up normally or go into test mode. Then your test procedure would be, attach debugger to SWD, write the bit pattern into memory, reset to get it to initialise and start reading the RTT input, and then send data down the Segger RTT pipe to perform your tests.

  • Thanks for your answer. I didn't know that it was possible to receive commands from RTT. Thanks for pointing that, a test mode seems a good idea. The target t this test is to validate that complex component are well mounted on the PCB. It needs several little screw to make contact on the PCB and is a sensible part of the module. Of course, it is not as simple as toggle a GPIO to test this component because a specific frequency must be generated to test it, so I need to send command to the module to run the test.

Related