This CLI (Command Line Interface) is based mbed-os. Both NNN50 and NQ620 are supported.

Fork of NNN40_CLI by Delta

BLE CLI Document can be downloaded here .

Note that when evaluate using Windows PC as the host, the Serial driver need to be installed in advance. The instruction is explained in the link below

https://developer.mbed.org/handbook/Windows-serial-configuration

Once installed, a device called 'mbed Serial Port (COM#)' should be recognized in Device Manager, as shown below

/media/uploads/tsungta/mbed_serial_port_1.png

Please open the com port at 115200 8n1 as default

Committer:
gillwei7
Date:
Sat Nov 07 09:02:38 2015 +0000
Revision:
4:b52035367aee
Parent:
3:38ec8ad317f4
Child:
17:03c8af30087a
20151107_Gill Wei commit_change to BLE API/nRF library API; _known bug : if write longer data than before, Read data need twice.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
gillwei7 0:5c195ab2f696 1 #include "mbed.h"
gillwei7 0:5c195ab2f696 2 #include "Gap.h"
gillwei7 0:5c195ab2f696 3 #include "command-interpreter.h"
gillwei7 3:38ec8ad317f4 4 #include "nrf_gpio.h"
gillwei7 0:5c195ab2f696 5
gillwei7 3:38ec8ad317f4 6 #define UART_2ND_TX p16
gillwei7 3:38ec8ad317f4 7 #define UART_2ND_RX p17
gillwei7 3:38ec8ad317f4 8 #define UART_2ND_TX_PIN 16
gillwei7 3:38ec8ad317f4 9 #define UART_2ND_RX_PIN 17
gillwei7 0:5c195ab2f696 10 DigitalOut swio(p19);
gillwei7 0:5c195ab2f696 11 Serial console(TX_PIN_NUMBER,RX_PIN_NUMBER);
gillwei7 4:b52035367aee 12
gillwei7 0:5c195ab2f696 13 int main(void)
gillwei7 0:5c195ab2f696 14 {
gillwei7 3:38ec8ad317f4 15
gillwei7 3:38ec8ad317f4 16 /* Removing Select external 32MHz crystal for NNN40-DT1R */
gillwei7 3:38ec8ad317f4 17 uint8_t inputChar;
gillwei7 3:38ec8ad317f4 18 nrf_gpio_cfg_output(7);
gillwei7 3:38ec8ad317f4 19 nrf_gpio_pin_set(7);
gillwei7 3:38ec8ad317f4 20 // gill 20150914 Re-configure UART pin by UART_2ND_CFG_PIN
gillwei7 3:38ec8ad317f4 21 //nrf_gpio_cfg_input(UART_2ND_TX_PIN, NRF_GPIO_PIN_NOPULL);
gillwei7 3:38ec8ad317f4 22 nrf_gpio_cfg_input(UART_2ND_RX_PIN, NRF_GPIO_PIN_PULLDOWN);
gillwei7 3:38ec8ad317f4 23 wait(0.5);
gillwei7 3:38ec8ad317f4 24 //console.printf("UART RX 2ND READ %i\r\n",nrf_gpio_pin_read(UART_2ND_RX_PIN));
gillwei7 3:38ec8ad317f4 25 if (nrf_gpio_pin_read(UART_2ND_RX_PIN))
gillwei7 3:38ec8ad317f4 26 {
gillwei7 3:38ec8ad317f4 27 Serial console(UART_2ND_TX,UART_2ND_RX);
gillwei7 3:38ec8ad317f4 28 //console.baud(115200);
gillwei7 3:38ec8ad317f4 29 //console.printf("UART RX 2ND READ %i\r\n",nrf_gpio_pin_read(UART_2ND_RX_PIN));
gillwei7 3:38ec8ad317f4 30 }
gillwei7 3:38ec8ad317f4 31 else
gillwei7 3:38ec8ad317f4 32 {
gillwei7 3:38ec8ad317f4 33
gillwei7 3:38ec8ad317f4 34 }
gillwei7 3:38ec8ad317f4 35 console.baud(115200);
gillwei7 3:38ec8ad317f4 36
gillwei7 0:5c195ab2f696 37 /* swio default low for BLE RF */
gillwei7 0:5c195ab2f696 38 swio = 0;
gillwei7 3:38ec8ad317f4 39 console.printf("\r\nDELTA BLE with WiFi\r\n");
gillwei7 0:5c195ab2f696 40 while(1) {
gillwei7 0:5c195ab2f696 41 while (NRF_UART0->EVENTS_RXDRDY != 1)
gillwei7 0:5c195ab2f696 42 {
gillwei7 0:5c195ab2f696 43 // Wait for RXD data to be received
gillwei7 0:5c195ab2f696 44 }
gillwei7 0:5c195ab2f696 45 NRF_UART0->EVENTS_RXDRDY = 0;
gillwei7 3:38ec8ad317f4 46 inputChar = (uint8_t)NRF_UART0->RXD;
gillwei7 3:38ec8ad317f4 47 //char input = inputChar;
gillwei7 3:38ec8ad317f4 48 // console.printf(&input);
gillwei7 3:38ec8ad317f4 49
gillwei7 0:5c195ab2f696 50 cyntecProcessCommandInput(inputChar);
gillwei7 0:5c195ab2f696 51 }
gillwei7 0:5c195ab2f696 52 }