Peripherals =============== CPU reset have been enabled, even though push-putton for it haven't been soldered to board. Code have been just added for option. .. code-block:: C void init_GPIO(){ NRF_P0->DIR |= (1<<7); //****SET RESET BUTTON TO USEABLE STATE****** NRF_P0->PIN_CNF[21]=3<<2;//pullup NRF_UICR->PSELRESET[0]=21; NRF_UICR->PSELRESET[1]=21; //******************************************* } PWM0 have been set to pin 18 and pin 17, which form channel 1 and 2 at board. Mode have been set to count up/down, meaning that when compare match counting up, pin goes up, counting down at match pin goes down like in following picture OUT[0]. .. image:: pwm_figure.png :width: 400 :alt: pwm figure Since counterstop value have been added to 100, counter only counts until value 100 and then start counting down. PWM0_1-variable is uint16_t and size of array is 4 since it's required by hardware to work proberly even though only 2 channels is used by PWM0. .. code-block:: C static void init_PWM(){ //*****CH1 & 2 PWM0_1[0]=100; PWM0_1[1]=100; PWM0_1[2]=100; PWM0_1[3]=100; //PWM out PIN 18 & 17 //CH0 & 1 NRF_PWM0->PSEL.OUT[0] =18; NRF_PWM0->PSEL.OUT[1] =17; NRF_PWM0->ENABLE =1; //UP down counter -> Edge aligned NRF_PWM0->MODE=1; //divide 0 -> 80kHz NRF_PWM0->PRESCALER=0; // NRF_PWM0->COUNTERTOP=100; NRF_PWM0->LOOP=0; NRF_PWM0->DECODER=2 | (0<<8); NRF_PWM0->SEQ[0].PTR=(uint32_t) &PWM0_1; NRF_PWM0->SEQ[0].CNT=4; NRF_PWM0->SEQ[0].REFRESH=1; NRF_PWM0->SEQ[0].ENDDELAY=0; NRF_PWM0->TASKS_SEQSTART[0]=1; //************************* //*****CH3 & 4 PWM2_3[0]=100; PWM2_3[1]=100; PWM2_3[2]=100; PWM2_3[3]=100; //PWM out PIN 16 & 15 //CH2 & 3 NRF_PWM1->PSEL.OUT[0] =16; NRF_PWM1->PSEL.OUT[1] =15; NRF_PWM1->ENABLE =1; //UP down counter -> Edge aligned NRF_PWM1->MODE=1; //divide 0 -> 80kHz NRF_PWM1->PRESCALER=0; // NRF_PWM1->COUNTERTOP=100; NRF_PWM1->LOOP=0; NRF_PWM1->DECODER=2 | (0<<8); NRF_PWM1->SEQ[0].PTR=(uint32_t) &PWM2_3; NRF_PWM1->SEQ[0].CNT=2; NRF_PWM1->SEQ[0].REFRESH=1; NRF_PWM1->SEQ[0].ENDDELAY=0; NRF_PWM1->TASKS_SEQSTART[0]=1; } Channels 3 and 4 follows same formula but with PWM1 register used. Second PWM peripheral is only used to allow differend frequency than channel 1 and 2 uses. I2C-serial interface have been initialized quite simply: choose what pin for SDA and SCL, set static frequency to 100KHz and enable I2C-peripheral. .. code-block:: C void init_i2c(uint8_t SDA_port,uint8_t SCL_port){ //Pin 3 for i2c clock and pin4 for data NRF_TWI0->PSELSCL=SCL_port; NRF_TWI0->PSELSDA=SDA_port; //speed rate 100khz and set address NRF_TWI0->FREQUENCY=0x01980000; //enable I2C NRF_TWI0->ENABLE=6; } This software only uses I2C to transmit data with no register addresses on other device, so there is no reason to transmit register address where to write. Device address is mandatory transmit like bus standard tells. .. code-block:: C void i2c_write_byte_no_reg(uint8_t dev_addr,uint8_t data){ static uint8_t tx_buf[4]; tx_buf[0]=data; NRF_TWIM0->SHORTS = TWIM_SHORTS_LASTTX_STOP_Msk; //i2c address NRF_TWI0->ADDRESS=dev_addr; //send amount of tx buf NRF_TWIM0->TXD.MAXCNT=1; NRF_TWIM0->TXD.PTR=(uint32_t)&tx_buf[0]; //ENABLE I2C NRF_TWI0->ENABLE=6; //clear just in case NRF_TWIM0->EVENTS_STOPPED=0; //start tx NRF_TWIM0->TASKS_STARTTX=1; //wait until transmission is complete while(NRF_TWIM0->EVENTS_STOPPED==0); NRF_TWI0->ENABLE=0; }