From: Phil Elwell <phil-FnsA7b+Nu9XbIbC87yuRow@public.gmane.org>
To: Eric Anholt <eric-WhKQ6XTQaPysTnJN9+BGXg@public.gmane.org>,
Marcel Holtmann <marcel-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org>,
Loic Poulain
<loic.poulain-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: "devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Johan Hedberg
<johan.hedberg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Scott Branden <sbranden-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>,
Ray Jui <rjui-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>,
"open list:BLUETOOTH DRIVERS"
<linux-bluetooth-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH v3 2/3] ARM: dts: bcm2837-rpi-3-b: Add bcm43438 as serial slave
Date: Thu, 17 Aug 2017 21:08:17 +0100 [thread overview]
Message-ID: <a86d58d2-e090-c172-5f76-7ced44fec6d3@raspberrypi.org> (raw)
In-Reply-To: <87shgqgo7b.fsf-omZaPlIz5HhaEpDpdNBo/KxOck334EZe@public.gmane.org>
On 17/08/2017 17:21, Eric Anholt wrote:
> Marcel Holtmann <marcel-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org> writes:
>
>> Hi Loic,
>>
>>>>>> < HCI Command: Broadcom Write UART Clock Setting (0x3f|0x0045) plen 1
>>>>>> 01 .
>>>>>>> HCI Event: Command Complete (0x0e) plen 4
>>>>>> Broadcom Write UART Clock Setting (0x3f|0x0045) ncmd 1
>>>>>> Status: Unknown HCI Command (0x01)
>>>>>>
>>>>>> And I am seeing fun stuff like failed frame assembly.
>>>>>>
>>>>>> [ 888.687594] Bluetooth: hci0: BCM: chip id 94
>>>>>> [ 888.687821] Bluetooth: hci0: BCM43430A1 (001.002.009) build 0182
>>>>>> [ 892.059023] Bluetooth: hci0: Frame reassembly failed (-84)
>>>>>> [ 892.316936] Bluetooth: hci0: BCM: failed to write clock (-56)
>>>>>> [ 892.429478] Bluetooth: hci0: BCM (001.002.009) build 0182
>>>>>>
>>>>>> Actually not providing the firmware makes the controller work. It however is stuck ad AA:AA:.. default address. Providing the firmware turns the address active. However then it never completes.
>>>>> I've tried on and off to get the BT working, there seems to lots of
>>>>> options and bits needed including some patches to the bluez [1] stuff
>>>>> but between not quite upstream kernel bits and numerous distros all
>>>>> doing it slightly differently I've never got it to work well.
>>>>>
>>>>> The yocto [1] bits seem fairly representative of some the patches
>>>>> flying around "to get it working" although I'm not sure how many of
>>>>> these are actually required and how many are superfluous with this
>>>>> patch set. There seems to be a firmware required that's not
>>>>> distributed with linux-firmware which would also be nice to resolve.
>>>> Non of these Yocto patches are actually needed. The culprit is the .oper_speed setting to be 4Mbps. Once you reduce that to 921600 thing will start to work smoothly. I sent a patch that takes the .oper_speed out completely and only applies it for the ACPI based devices where we know that it works.
>>>>
>>>> With my patch and the right DT entries for uart0 it actually works with “btattach -B /dev/ttyAMA0 -P bcm”. It will load the firmware, configure it and head towards the right path.
>>>>
>>>> Obviously btattach is only an interim step here. Loic’s patches for serdev integration and changing the DT to expose uart0 as serial-slave for Bluetooth is the right approach. Once Loic’s resends the patches we can get them into bluetooth-next and start merging these towards upstream. After that, Bluetooth should work just out of the box like with any USB dongle.
>>>>
>>>> And the Yocto patches should be abandoned. If using H:5 (aka 3-Wire) instead of H:4 is possible, we could consider it, but as long as the UART wiring doesn’t cause any bit errors, it is not worth it.
>>>>
>>>> That said, I do see a "Bluetooth: hci0: Frame reassembly failed (-84)” error. I need to figure out where that is. Frankly we really need to hexdump the packet when this happens.
>>>>
>>>
>>> I also meet this Frame reassembly failure, Seems we receive a 0x00 byte from the controller (unknown pkt type).
>>
>> that means adding something like this will silence it.
>>
>> +#define BCM_RECV_NULL \
>> + .type = 0x00, \
>> + .hlen = 0, \
>> + .loff = 0, \
>> + .lsize = 0, \
>> + .maxlen = 0
>> +
>> +static int bcm_recv_null(struct hci_dev *hdev, struct sk_buff *skb)
>> +{
>> + kfree_skb(skb);
>> + return 0;
>> +}
>> +
>> static const struct h4_recv_pkt bcm_recv_pkts[] = {
>> { H4_RECV_ACL, .recv = hci_recv_frame },
>> { H4_RECV_SCO, .recv = hci_recv_frame },
>> { H4_RECV_EVENT, .recv = hci_recv_frame },
>> { BCM_RECV_LM_DIAG, .recv = hci_recv_diag },
>> + { BCM_RECV_NULL, .recv = bcm_recv_null },
>> };
>>
>> It does silence it indeed. Maybe this is some of their markers to
>> ensure that the baud rate change worked. Or it is the indication that
>> the reset completed. Do you happen to know between which commands we
>> receive it?
>>
>>> Regarding the speed, I'm unable to reach 3Mbps, I selected 921600
>>> because this is the baudrate used by raspbian bt script.
>>
>> That is the same I experienced. The 921600 works fine, but trying
>> 3Mbps doesn’t. However it seems with hciattach you can crank it up to
>> 3Mpbs somehow. Maybe the delay is just to short for the UART switching
>> in that case.
>>
>>> Maybe they had some issues at higher speed (empirical value ?),
>>> However 2Mbps seems ok on my side (need to double check/adjust).
>>
>> We have to make it a DT max-speed param anyway. So I am not that
>> worried.
>>
>>> In a second step, need to check If we can use hardware flow control,
>>> I heard that pin 16&17 are routed to the bcm RTS/CTS. Since there is
>>> no DMA usage, it could help.
>
> The BT's CTS/RTS are tied to 3v3/ground.
>
>> Eric, any chance you can dig out the recommendation for the Bluetooth
>> controller usage? I would also like to see the recommended PCM
>> settings for this hardware. It bet it is somehow wired up to the sound
>> controller.
>
> BT's PCM is connected to gpio 28-31 on the pi3, which you can pinmux to
> the i2s controller (pcm_gpio28 pin group).
>
> I'm not clear on what you're asking for, or where I would go to find
> anything else. However, for integration stuff on the board, Phil, Dom,
> and Gordon at RPi are likely to know more.
Eric is correct - GPIOs 28-31 on the Pi 3B are connected to the PCM function on
the 43438. We haven't made use of those pins, and we are unlikely to. On the
Zero W, 30 and 31 are connected to the BT RTS and CTS, but on Pi 3B the flow control
pins are not connected, hence the baud rate restriction due to the risk of data
loss - particularly likely and fatal during firmware uploaded since at boot time
systemd is "aggresively parallel". This is the reason for the BlueZ patch that
defers switching to the higher baudrate until after firmware loading is complete.
Regards,
Phil
next prev parent reply other threads:[~2017-08-17 20:08 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-07 10:39 [PATCH v3 1/3] dt-bindings: net: bluetooth: Add broadcom-bluetooth Loic Poulain
[not found] ` <1502102366-2760-1-git-send-email-loic.poulain-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-08-07 10:39 ` [PATCH v3 2/3] ARM: dts: bcm2837-rpi-3-b: Add bcm43438 as serial slave Loic Poulain
[not found] ` <1502102366-2760-2-git-send-email-loic.poulain-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-08-09 23:10 ` Rob Herring
[not found] ` <CAL_JsqKxA2pgtjmG-cxy5XPWuRWUiia-weRZDSh4++Vn=QZmqA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-08-10 16:15 ` Marcel Holtmann
[not found] ` <8186E2A3-D0AC-498F-8229-78862D363F78-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org>
2017-08-14 13:56 ` Loic Poulain
[not found] ` <392e6d51-33d6-1585-6582-1397a0c64852-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-08-14 16:02 ` Marcel Holtmann
[not found] ` <161632C7-EBBF-47F5-86DC-453E10395B54-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org>
2017-08-14 17:32 ` Loic Poulain
[not found] ` <e001e055-10a5-facd-a8e1-57c1bdb78172-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-08-14 17:39 ` Stefan Wahren
2017-08-14 18:36 ` Marcel Holtmann
2017-08-14 22:16 ` Marcel Holtmann
[not found] ` <FCD47ED6-F01F-4921-97A3-BBC1D0263747-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org>
2017-08-15 4:39 ` Marcel Holtmann
2017-08-16 12:37 ` Peter Robinson
[not found] ` <CALeDE9MeMHtCD8esCcznHjS+z6o7Ezh9dP1OZq=77DuYNS2=2A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-08-16 14:52 ` Marcel Holtmann
[not found] ` <0C198B33-8CB6-4D6A-B89F-35D3CD771135-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org>
2017-08-17 10:07 ` Loic Poulain
[not found] ` <92579650-5eb0-cdf2-405a-7c5be9c54770-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-08-17 10:35 ` Marcel Holtmann
[not found] ` <8CF7E37E-BF1C-4E32-AF3A-E44BA2E5A2B9-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org>
2017-08-17 10:47 ` Marcel Holtmann
2017-08-17 16:21 ` Eric Anholt
[not found] ` <87shgqgo7b.fsf-omZaPlIz5HhaEpDpdNBo/KxOck334EZe@public.gmane.org>
2017-08-17 17:34 ` Marcel Holtmann
[not found] ` <E1FFE8C1-97C9-4640-A12A-3AE37F9B655F-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org>
2017-08-17 19:38 ` Eric Anholt
2017-08-17 20:08 ` Phil Elwell [this message]
2017-08-15 13:06 ` Marcel Holtmann
[not found] ` <43820E05-9D40-4470-AE6C-B7B6C705E0A5-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org>
2017-08-15 19:12 ` Rob Herring
2017-08-07 10:39 ` [PATCH v3 3/3] Bluetooth: hci_bcm: Add serdev support Loic Poulain
2017-08-09 23:16 ` [PATCH v3 1/3] dt-bindings: net: bluetooth: Add broadcom-bluetooth Rob Herring
[not found] ` <CAL_Jsq+akZpqXMPnSh8KRVchWJpFTrzFi6LpOpJ9FYDCrY1hPQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-08-15 17:42 ` Eric Anholt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a86d58d2-e090-c172-5f76-7ced44fec6d3@raspberrypi.org \
--to=phil-fnsa7b+nu9xbibc87yurow@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=eric-WhKQ6XTQaPysTnJN9+BGXg@public.gmane.org \
--cc=johan.hedberg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linux-bluetooth-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=loic.poulain-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=marcel-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org \
--cc=rjui-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=sbranden-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).