<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Bcm43438 bluetooth don't work on linux in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/Bcm43438-bluetooth-don-t-work-on-linux/m-p/763219#M118538</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone, I am trying to use bcm43438 on linux, and the wifi is working well. But when i use Bluez on linux to test the bluetooth, it doesn't work.&lt;/P&gt;&lt;P&gt;Firstly i use command 'hciattach /dev/ttymxc2 bcm43xx 3000000 flow -t 10' to init the device, but it will get time out, then I digged into the process, and I found the command will call function bcm43xx_init:&lt;/P&gt;&lt;P&gt;``````&lt;/P&gt;&lt;P&gt;int bcm43xx_init(int fd, int def_speed, int speed, struct termios *ti,&lt;/P&gt;&lt;P&gt;const char *bdaddr)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;char chip_name[20];&lt;/P&gt;&lt;P&gt;char fw_path[PATH_MAX];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;printf("bcm43xx_init\n");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (bcm43xx_reset(fd))&lt;/P&gt;&lt;P&gt;return -1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;printf("reset successfully\n"); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;&amp;nbsp;&lt;SPAN style="font-size: 22px;"&gt;&amp;nbsp;//whether program can get here&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (bcm43xx_read_local_name(fd, chip_name, sizeof(chip_name)))&lt;/P&gt;&lt;P&gt;return -1;&lt;/P&gt;&lt;P&gt;printf("read local name successfully\n");&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="font-size: 22px;"&gt;&amp;nbsp;&lt;STRONG&gt; //whether program can get here&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (bcm43xx_locate_patch(FIRMWARE_DIR, chip_name, fw_path)) {&lt;/P&gt;&lt;P&gt;fprintf(stderr, "Patch not found, continue anyway\n");&lt;/P&gt;&lt;P&gt;} else {&lt;/P&gt;&lt;P&gt;if (bcm43xx_set_speed(fd, ti, speed))&lt;/P&gt;&lt;P&gt;return -1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (bcm43xx_load_firmware(fd, fw_path))&lt;/P&gt;&lt;P&gt;return -1;&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt;`````````````````````&lt;/P&gt;&lt;P&gt;I add two 'printf' to indicate where is wrong, and the result shows it can reset successfully then get time out. So it gets time out in bcm43xx_read_local_name, the code is like this:&lt;/P&gt;&lt;P&gt;````````````````````````&lt;/P&gt;&lt;P&gt;static int bcm43xx_read_local_name(int fd, char *name, size_t size)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;unsigned char cmd[] = { HCI_COMMAND_PKT, 0x14, 0x0C, 0x00 };&lt;/P&gt;&lt;P&gt;unsigned char *resp;&lt;/P&gt;&lt;P&gt;unsigned int name_len;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;resp = malloc(size + CC_MIN_SIZE);&lt;/P&gt;&lt;P&gt;if (!resp)&lt;/P&gt;&lt;P&gt;return -1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tcflush(fd, TCIOFLUSH);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (write(fd, cmd, sizeof(cmd)) != sizeof(cmd)) {&lt;/P&gt;&lt;P&gt;fprintf(stderr, "Failed to write read local name command\n");&lt;/P&gt;&lt;P&gt;goto fail;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 22px;"&gt;// it is stucked here&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;if (read_hci_event(fd, resp, size) &amp;lt; CC_MIN_SIZE) {&lt;/P&gt;&lt;P&gt;fprintf(stderr, "Failed to read local name, invalid HCI event\n");&lt;/P&gt;&lt;P&gt;goto fail;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (resp[4] != cmd[1] || resp[5] != cmd[2] || resp[6] != CMD_SUCCESS) {&lt;/P&gt;&lt;P&gt;fprintf(stderr, "Failed to read local name, command failure\n");&lt;/P&gt;&lt;P&gt;goto fail;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;`````&lt;/P&gt;&lt;P&gt;After I tried many times, I found it is stucked in read_hci_event function, the host can not get response from device. But it can get response in bcm43xx_reset(), so i think it is the problem of hci command, then i changed the hci command many times, it turned out the device only response to the reset hci command. I don't know why is it so.&lt;/P&gt;&lt;P&gt;The Bluez version is 5.37 and the linux kernel is 4.1.38.&lt;/P&gt;&lt;P&gt;Please give me some advice, thanks very much.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 17 May 2018 07:55:14 GMT</pubDate>
    <dc:creator>chengsi</dc:creator>
    <dc:date>2018-05-17T07:55:14Z</dc:date>
    <item>
      <title>Bcm43438 bluetooth don't work on linux</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Bcm43438-bluetooth-don-t-work-on-linux/m-p/763219#M118538</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone, I am trying to use bcm43438 on linux, and the wifi is working well. But when i use Bluez on linux to test the bluetooth, it doesn't work.&lt;/P&gt;&lt;P&gt;Firstly i use command 'hciattach /dev/ttymxc2 bcm43xx 3000000 flow -t 10' to init the device, but it will get time out, then I digged into the process, and I found the command will call function bcm43xx_init:&lt;/P&gt;&lt;P&gt;``````&lt;/P&gt;&lt;P&gt;int bcm43xx_init(int fd, int def_speed, int speed, struct termios *ti,&lt;/P&gt;&lt;P&gt;const char *bdaddr)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;char chip_name[20];&lt;/P&gt;&lt;P&gt;char fw_path[PATH_MAX];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;printf("bcm43xx_init\n");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (bcm43xx_reset(fd))&lt;/P&gt;&lt;P&gt;return -1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;printf("reset successfully\n"); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;&amp;nbsp;&lt;SPAN style="font-size: 22px;"&gt;&amp;nbsp;//whether program can get here&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (bcm43xx_read_local_name(fd, chip_name, sizeof(chip_name)))&lt;/P&gt;&lt;P&gt;return -1;&lt;/P&gt;&lt;P&gt;printf("read local name successfully\n");&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="font-size: 22px;"&gt;&amp;nbsp;&lt;STRONG&gt; //whether program can get here&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (bcm43xx_locate_patch(FIRMWARE_DIR, chip_name, fw_path)) {&lt;/P&gt;&lt;P&gt;fprintf(stderr, "Patch not found, continue anyway\n");&lt;/P&gt;&lt;P&gt;} else {&lt;/P&gt;&lt;P&gt;if (bcm43xx_set_speed(fd, ti, speed))&lt;/P&gt;&lt;P&gt;return -1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (bcm43xx_load_firmware(fd, fw_path))&lt;/P&gt;&lt;P&gt;return -1;&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt;`````````````````````&lt;/P&gt;&lt;P&gt;I add two 'printf' to indicate where is wrong, and the result shows it can reset successfully then get time out. So it gets time out in bcm43xx_read_local_name, the code is like this:&lt;/P&gt;&lt;P&gt;````````````````````````&lt;/P&gt;&lt;P&gt;static int bcm43xx_read_local_name(int fd, char *name, size_t size)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;unsigned char cmd[] = { HCI_COMMAND_PKT, 0x14, 0x0C, 0x00 };&lt;/P&gt;&lt;P&gt;unsigned char *resp;&lt;/P&gt;&lt;P&gt;unsigned int name_len;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;resp = malloc(size + CC_MIN_SIZE);&lt;/P&gt;&lt;P&gt;if (!resp)&lt;/P&gt;&lt;P&gt;return -1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tcflush(fd, TCIOFLUSH);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (write(fd, cmd, sizeof(cmd)) != sizeof(cmd)) {&lt;/P&gt;&lt;P&gt;fprintf(stderr, "Failed to write read local name command\n");&lt;/P&gt;&lt;P&gt;goto fail;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 22px;"&gt;// it is stucked here&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;if (read_hci_event(fd, resp, size) &amp;lt; CC_MIN_SIZE) {&lt;/P&gt;&lt;P&gt;fprintf(stderr, "Failed to read local name, invalid HCI event\n");&lt;/P&gt;&lt;P&gt;goto fail;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (resp[4] != cmd[1] || resp[5] != cmd[2] || resp[6] != CMD_SUCCESS) {&lt;/P&gt;&lt;P&gt;fprintf(stderr, "Failed to read local name, command failure\n");&lt;/P&gt;&lt;P&gt;goto fail;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;`````&lt;/P&gt;&lt;P&gt;After I tried many times, I found it is stucked in read_hci_event function, the host can not get response from device. But it can get response in bcm43xx_reset(), so i think it is the problem of hci command, then i changed the hci command many times, it turned out the device only response to the reset hci command. I don't know why is it so.&lt;/P&gt;&lt;P&gt;The Bluez version is 5.37 and the linux kernel is 4.1.38.&lt;/P&gt;&lt;P&gt;Please give me some advice, thanks very much.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 May 2018 07:55:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Bcm43438-bluetooth-don-t-work-on-linux/m-p/763219#M118538</guid>
      <dc:creator>chengsi</dc:creator>
      <dc:date>2018-05-17T07:55:14Z</dc:date>
    </item>
    <item>
      <title>Re: Bcm43438 bluetooth don't work on linux</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Bcm43438-bluetooth-don-t-work-on-linux/m-p/763220#M118539</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Cheng&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please check linux documentation on below link and post issue to vendor support using&lt;/P&gt;&lt;P&gt;guidelines provided there:&lt;/P&gt;&lt;P&gt;wireless.murata.com/eng/products/rf-modules-1/wi-fi-bluetooth-for-nxp-i-mx.html&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;BR /&gt;igor&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 May 2018 01:50:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Bcm43438-bluetooth-don-t-work-on-linux/m-p/763220#M118539</guid>
      <dc:creator>igorpadykov</dc:creator>
      <dc:date>2018-05-18T01:50:16Z</dc:date>
    </item>
  </channel>
</rss>

