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

nRF5_SDK_15.0.0\examples\peripheral\usbd_cdc_acm\pca10056\blank\ses\ usbd_cdc_acm_pca10056.emProject.

Hello,

We have bought two EVAL boards, nRF52840-DK, in order to try our goal to add to our already working projects BLE option.  This happened about two weeks ago, and since then the more I try the examples in the stack, the more I’m convinced that I do need to be a wireless expert on account of being focused on my project.

(Contrary to the promises on:

https://www.bluetooth.com/develop-with-bluetooth/build

You don’t have to be a wireless expert to add wireless connectivity to your products. Bluetooth technology is easy to implement, allowing you to focus on your product’s value add.

  • Full stack solution: Bluetooth technology is a fully specified connectivity solution, from low-level radio to high-level service definition. This enables you to focus on being a product developer, not a wireless developer.​
  • Best fit-for-purpose: Bluetooth provides complete wireless connectivity services, not just wireless transport. )

I used  nRF5_SDK_15.0.0_a53641a with SEGGER Embedded Studio for ARM
Release 3.40  Build 2018052200.36079 Windows x64.

I tried many examples from the peripheral sub folder:

C:\Nordic_Semi\nRF5_SDK_15.0.0\examples\peripheral\*.*

For the USB I’ve selected:

C:\Nordic_Semi\nRF5_SDK_15.0.0\examples\peripheral\usbd_cdc_acm\pca10056\blank\ses\ usbd_cdc_acm_pca10056.emProject.

Two great problems with this example:

  1. After compilation it works properly (as described nRF5_SDK_15.0.0_offline_doc) only if the debugger is disconnected. Even if no breakpoints at all, when running from the debugger the terminal emulator on the PC shows nothing. When adding breakpoints the program stops, however progressing from the breakpoint in “single step” doesn’t. (I wrote a simple program using just a timer, which creates an interrupt each 500ms, and LEDS 1 through 4 are toggled one by one. This simple program can run from the debugger, and the breakpoints plus the “single step” work correctly.)
  2. I want to read and write the USB (i.e. calling the functions  app_usbd_cdc_acm_read()  and app_usbd_cdc_acm_write() )  when and from where I need, not subjected to paradigms, models or profiles. However, calling  app_usbd_cdc_acm_write()   from a different part of the program returns “ERROR 8” which is documented as “Invalid state, operation disallowed in this state”. This happened because the  calling  app_usbd_cdc_acm_write() was departed from its preceding function:  “  while (app_usbd_event_queue_process()) {// nothing to do };   “

Theoretically I should not care to add that line if it helps the code to work. However that line stops the program from executing the USB write function till PBUTTON_1 is pressed.

To strip down this unsolicited matching of LED1, PBUTTON1, and the USBD there is a need of clear configuration API to all of the CPU’s peripherals. The configuration functions include monster parameters, especially the handles which encapsulate giant structures with function pointers, sometimes in macro forms.

Under the Project folder, as expected, there is a separate subfolder for the application, named “Application”, and many other subfolders for the STACK, (nRF_Driversr, nRF_Libraries etc.).

Surprisingly, the subfolder “Application” contains only the main.c and sdk_config.h files. The sdk_config.h file is just a very long list of defining the SDK modules to be included. There are no other configuration files serving as API for the user.

At ST-semiconductors there are several configuration files (*.h  and *.c) in the Application folder. The *.h files contain clear defines for instance selection of ports, USBx ,UARTx SPIx DMAx  etc. The *.c files have clear callback functions, priority settings etc. Modifying the callback functions, or any other API configuration file in the “Application” subfolder configures the stack  without overwriting the stack’s source code.     

Actually I need this freedom for all peripherals, To read/write the SPI, UART, RADIO modules when I need them, or send them to SLEEP if it possible for my flowchart.

Thanks

Parents Reply Children
No Data
Related