Skip to content

How to Run AP Mode

Description

This example demonstrates the use of the Wi-Fi module with the Pitaya Go board to behave as an AP.

This example also implements the Command Line Interface over BLE NUS and USB CDC ACM. Both consoles can be opened and used independently.

Note

The Wi-Fi module supports AP mode operation with the following limitations:

  • Only one associated station is supported. After a connection is established with a station, further connections are rejected.
  • The device could not work as a station in this mode (STA/AP concurrency is not supported).

Tip

Before you start building, remember to set up the nRF5 SDK development environment first. See Setup the nRF5 SDK for details.

Building the example

You can find the source code and the project file of the example in the following folder: pitaya-go/examples/wifi/mode_ap_example.

Open terminal and navigate to the directory with the example Makefile:

cd ./pitaya-go/examples/wifi/mode_ap_example/armgcc

Run make to build the example:

make

Programming the firmware

If compiled successfully, the firmware is located in mode_ap_example/armgcc/_build with the name nrf52840_xxaa.hex.

While pushing the USER button, press the RESET button to enter the DFU mode. Then program the firmware using the nRF Connect for Desktop tool.

If the SoftDevice is not programmed before, remember to add the SoftDevice. The SoftDevice is located in <nRF5 SDK>/components/softdevice/s140/hex/s140_nrf52_6.1.0_softdevice.hex.

Tip

See Programming section for details about how to program your Pitaya Go.

Testing

The application is now programmed and running. Perform the following steps to act as an AP:

  1. Run a terminal application like PuTTY or screen:

    screen /dev/cu.usbmodemD2E39D222D781 115200
    
  2. Press Enter in the terminal. A console prompt is displayed.

  3. Use command wifi to print the command help information.

  4. Use command wifi enable_ap {NAME} {PWD} to start an AP, where {NAME} is the name of the AP and {PWD} is the password of the AP. If you want to create an Open network, {PWD} can be left blank.

  5. Use a mobile device to scan the network and join it.

  6. Observe that BLUE LED is lit and the station IP will display, that is, the device is connected.

  7. You can use command wifi disable_ap to disable the AP. Observe that BLUE LED is off.

  8. You can also use the Web Device CLI application to test this example.

Create an Issue

Interested in contributing to this project? Want to report a bug? Feel free to click here: