Good morning everyone,
I am facing a weird problem concerning the use of the UART service.
I am currently using the NRF52832DK to develop an application. In a nutshell, I am reading a temperature via a TWI-connected sensor every 2 seconds, and I want to send it to a smartphone using the UART service.
I started developing my application from the ble_template app, and so far everything works fine: I was able to set a timer for the periodic reading, and I am able to correctly read the data from the TWI.
The problem starts when I try to use the UART profile.
First of all, if I simply change the name of the available service from
static ble_uuid_t m_adv_uuids[] = /**< Universally unique service identifiers. */ { {BLE_UUID_DEVICE_INFORMATION_SERVICE, BLE_UUID_TYPE_BLE} };
to
static ble_uuid_t m_adv_uuids[] = /**< Universally unique service identifier. */ { {BLE_UUID_NUS_SERVICE, NUS_SERVICE_UUID_TYPE} };
the application crashes. By "Crashes" I mean that if I enable the UART log I see that "Fatal Error" is printed out almost immediately; if I disable
the UART log (I saw on the forum that UART log is not available if using the UART as a service), then I don't see any communication on the TWI, nor I see
LEDs blinking for advertising; I reasonably assume that the app is not starting.
If I leave unchanged the name of the service, I got an error in another part of the code, namely in the uart_init function (copied from the ble_uart_app example), and
again I got a fatal error and nothing running.
Finally, if I don't call the uart_init, but I only try to start the services (services_init), I got in the following function
static void services_init(void) { uint32_t err_code; ble_nus_init_t nus_init; memset(&nus_init, 0, sizeof(nus_init)); nus_init.data_handler = nus_data_handler; err_code = ble_nus_init(&m_nus, &nus_init); APP_ERROR_CHECK(err_code); }
an error code 4, which I saw means "NO MEMORY FOR OPERATION".
I read a lot of similar problems, and I tried all the suggested configurations (deactivating UART log, importing all the correct files and dependencies and so on), I followed the Service,Configuration and Advertising tutorials and I am currently out of ideas.....
A sidenote: the ble_uart_app example as it is, works without problems.
I suspect I am missing a small configuration detail, but I have really no idea what it could be....
I am using softdevice 132, pins P0.11 and P0.12 for SDA and SCL and the UART example pins.
Thank you for your help!