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

programing and interrupts on custom PCB using nrf51822

Hey,

I am designing a custom PCB with the nrf51822. I would like to use the reference layout that Nordic provides, specifically nrf51x22_qfaa. My project involves reading an accelerometer and gyroscope via TWI and transmitting certain measurements via BLE. I am designing this PCB in Altium Designer and I am using the reference files Nordic provides and footprints from their libraries.

I'd really appreciate it if any of you could help me clear up a few things:

1.) To program the chip on my custom PCB I am planning on including in my design the same 10 pin SWD header Nordic uses for the development boards with J-Link. Currently I am connecting SWDIO and SWCLK directly to the chip with a 12k pulldown resistor on SWCLK. Is this ideal? I'm confused about nrf_RST.

2.) When I connect my accelerometer and gyroscope to the nrf51822 via TWI can I use any GPIO pins I want? I am planning on connecting SCLK and SDA to GPIO pins 8 and 9 and then connecting interrupts to GPIO pins 10-13. I also need to be able to wakeup on interrupts. (I think I remember seeing something in the user guide about restrictions on these pins when Softdevice is enabled but cant find it). Also I am planning on not including any external resistors and just using the internal pull ups. Is this advisable?

Are there any other suggestions you have given the nature of my project? I'm a student and this is the first PCB I've designed.

Thanks for the help!

  • Hi,

    1. Yes, you can implement the programming interface like that. I was playing with the interface and if you accidentally forgot to put it there (like me :-) ), it works even without the 12k pull-down on SWCLK. But let it be there. The NRST pin is "integrated" into SWDIO pin. Thus, unlike for example the STM32 family, you need only 4 pins to program the device, not 5.

    2. Yes, you can use any pin for the interface. There is just a restriction on ADC - there is a specific range of pins as stated in datasheet. As for wakeup interrupts, I am not completely sure - try to find a corresponding page in datasheet and wait for advice from anyone else here. The internal pull-ups are fine, if the traces are short and do not include any excessive capacitance. Otherwise, you should experiment with external resistors to achieve optimum rise and fall shapes.

    PCB layout considerations - there is a lot of things to look after to make a good design. Just a short must-do list. Do not forget to make proper decoupling, several caps as close as possible to the power lines of the chip. A combination of several 1nF, 22nF, 100nF will make the job. Do not place any tracks under the balun and the 50 Ohm impedance matched trace to the antenna. There should be a clear ground plane line under the RF circuitry. If the path to the antenna is long, you must match the path to 50 Ohm. There are several calculators called "microstrip impedance calculator" or something like that on the Internet. Otherwise, you will lose some output power there and reduce the range. The power line should be stable, without any significant ripples. If not using 4-layer design and nice power plane, make the power traces wider than signal traces and make them as straight as possible, without many vias. Implement ESD protective devices to all connectors. Use low capacitance 32.768kHz and 16Mhz crystals and place them close to the chip.

    There are a lot of other tips and guidelines. Read some guides. This is a document from Texas Instruments about analog-digital circuits.

    www.ti.com/.../sloa089.pdf

    Or attend any PCB design orientated course. The PCB design can be a bit alchemy, especially if you are going over 100 Mhz or you are measuring very small signals and every detail matters. And well, RF design is a true magic :-).

  • Nice answer by mnhs here, but regarding the pull on SWDIO and SWDCLK. There are internal pulls on both, so you don't need the external (if you forget or don't want to add it).

    Q2: TWI can go to any pins, as stated by mnhs. I can't remember any restrictions with regard to wake up pins and softdevice, but the pins you are thinking of might be related to some code examples using pins for UART debugging? This would be application implementation and could easily be moved to other pins if wanted.

    I haven't gone into details on the guide from TI that mnhs is linking to, but it looks like a good place to get more information and to get some good points as to what to think about when designing.

  • Thanks for the info about pulls, good to know.

    I finally found the .pdf I wanted to post before but couldn't find it:

    www.ti.com/.../szza009.pdf

    This is an EMI guide. The topic is far more complicated but for the first PCB this should be enough Just a short note for MIchael Dietz - when making 2 layer PCB design, ground plane splitting cannot be fully avoided. But do the best to make it as uniform as possible, one additional hour when routing the PCB really pays off here.

Related