Unable to Read BT packets

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Unable to Read BT packets

585 Views
vinothpenati
Contributor I

Hi all,

   I am working on marshmallow BSP[6.0.1.2.1.0] in IMX6sl evk board. While trying to bring up the bluetooth, I am unable to read the bt driver packet continuously, I am able to send the command from android and response is coming up to my driver but android bt is unable to read the response packet. I found this at eager_reader.c file's following function

static void inbound_data_waiting(void *context) {
  eager_reader_t *reader = (eager_reader_t *)context;
 
  data_buffer_t *buffer = (data_buffer_t *)reader->allocator->alloc(reader->buffer_size + sizeof(data_buffer_t));
  if (!buffer) {
    LOG_ERROR("%s couldn't aquire memory for inbound data buffer.", __func__);
    return;
  }

  buffer->length = 0;
  buffer->offset = 0;

  int bytes_read = read(reader->inbound_fd, buffer->data, reader->buffer_size);
  if (bytes_read > 0) {
    // Save the data for later
    buffer->length = bytes_read;
    fixed_queue_enqueue(reader->buffers, buffer);

    // Tell consumers data is available by incrementing
    // the semaphore by the number of bytes we just read
    eventfd_write(reader->bytes_available_fd, bytes_read);
  } else {
    if (bytes_read == 0)
      LOG_WARN("%s fd said bytes existed, but none were found.", __func__);
    else
      LOG_WARN("%s unable to read from file descriptor: %s", __func__, strerror(errno));

    reader->allocator->free(buffer);
    break;
  }
}

Then I put while(1) to read the packets continuously. Packet reading is happening on.

static void inbound_data_waiting(void *context) {
  eager_reader_t *reader = (eager_reader_t *)context;
  while(1){        /* -------------> created by myself */
  data_buffer_t *buffer = (data_buffer_t *)reader->allocator->alloc(reader->buffer_size + sizeof(data_buffer_t));
  if (!buffer) {
    LOG_ERROR("%s couldn't aquire memory for inbound data buffer.", __func__);
    return;
  }

  buffer->length = 0;
  buffer->offset = 0;

  int bytes_read = read(reader->inbound_fd, buffer->data, reader->buffer_size);
  if (bytes_read > 0) {
    // Save the data for later
    buffer->length = bytes_read;
    fixed_queue_enqueue(reader->buffers, buffer);

    // Tell consumers data is available by incrementing
    // the semaphore by the number of bytes we just read
    eventfd_write(reader->bytes_available_fd, bytes_read);
  } else {
    if (bytes_read == 0)
      LOG_WARN("%s fd said bytes existed, but none were found.", __func__);
    else
      LOG_WARN("%s unable to read from file descriptor: %s", __func__, strerror(errno));

    reader->allocator->free(buffer);
    break;
  }
 }            /* --------------> created by myself */
}

But While trying to enable the BT form GUI it is not enabled, after three iteration of same procedure, it is turned on in GUI and able to see the list available bt devices. But unable to pair with other device, while other devices trying to pair with my evb, I got assertion assert(ble_supported) while trying to pair with evb, and GUI disable is not happening on properly. I think by default Marshmallow enables the BLE on state machine.

Please tell me that how to switch it to BT instead of turning on BLE and avoidance of multiple iteration of GUI turn on and turn off.

Thanks,

Vinoth P B

Labels (4)
0 Kudos
1 Reply

493 Views
igorpadykov
NXP Employee
NXP Employee

Hi Vinoth

please check murata android guide

http://wireless.murata.com/datasheet?/RFM/data/murata_quick_start_guide_android.pdf

also one can get support from murata registering on

Wi-Fi Bluetooth for NXP i.MX | RF Modules | Wireless Products | Murata Manufacturing | Murata Manufa... 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos