Pi 3 Bluetooth simple
Lothar (3292) 134 posts |
Hello, Bluetooth for RISC OS was already discussed here but always as a full Bluetooth stack supporting Bluetooth devices like keyboard etc. This could be indeed some work. But there may be a more simple approach and still useful: use of the Pi 3 CYW43438 as a Bluetooth-UART-bridge. In this way wireless serial commmunication could be established between two Pi 3: one could do some embedded measurements and the other displaying it on the desktop. The CYW43438 Bluetooth is connected to UART0 this is completely independent of the CYW43438 WLAN SDIO. Furthermore, different to Bluetooth-USB-dongles usage of USB stack is not needed. There is already a bare-metal project (not from me) for CYW43438 Bluetooth UART0. The question is: would it be better to implement Bluetooth-UART-bridge bare-metal first and then integrate into RISC OS? https://github.com/rsta2/circle “You need a Raspberry Pi 3 (with internal Bluetooth device) or an external USB Bluetooth BR/EDR dongle to use this sample” Thanks |
Timo Hartong (2813) 204 posts |
Hi, Did you already working on this. Would we then put Bluetooth in the HAL or put as device driver ?. |
Lothar (3292) 134 posts |
I did some initial work but currently need to work on other things e.g. Pi Zero W GPIO support and AUTOEXEC for embeddded applications. The problem with CYW43438 Bluetooth is I found the documentation quite poor and many things are just trial and error. This has a “simple” UART interface so should be easy in comparison to a Bluetooth USB dongle – but not so much. On the other hand what already works without problems is Pi 2 BCM2837 and external HC-05/06 Bluetooth with UART interface. But certainly it would be nice to do the same with Pi 3 BCM2837 and “internal” CYW43438 Bluetooth. |
Timo Hartong (2813) 204 posts |
Is the HC-05/06 already supported in RISC-OS ?. I was under impression that there was no Bluetooth support in RISC-OS at all. I have come to the conclusion that for Bluetooth the HAL is not the place. It will be more of a module. And as usual the documentation is poor. But hey the Pi is not open source it is more open learning ;-) |
Lothar (3292) 134 posts |
> Is the HC-05/06 already supported in RISC-OS There is no need these are configured by a serial terminal similar to here or in a BASIC program using serial module and then work as a wireless null modem between two Pi e.g. Pi 2 UART0 and Pi 3 UART1 https://www.riscosopen.org/news/articles/2016/04/06/get-connected-with-rool > CYW43438 Bluetooth This is internally connected to Pi 3 UART0 but how to do initial configuration is what is still needed. |
Timo Hartong (2813) 204 posts |
Did you already start with some code ?. |
Lothar (3292) 134 posts |
I understand you started working on Pi 3 UART0 using the HAL. Did you have any success? For me the recommended ROM OS_SerialOp does nothing: https://www.riscosopen.org/forum/forums/9/topics/6347 The Serial Block Drivers work but the programming examples do not work properly: https://www.riscosopen.org/forum/forums/11/topics/9368 Nevertheless with !Connector you can configure a Bluetooth module. However for Bluetooth communication from a program – with ROM OS_SerialOp not working – what I did now is operate the UART0 directly: bypassing the HAL. The attached code sends out a string. But if you do have success with the HAL please let me know. It would be much better if the ROM OS_SerialOp would work. Then I would think the best way to implement Bluetooth communication is a BASIC module to do some SWIs for it.
|
Lothar (3292) 134 posts |
> The Serial Block Drivers work but the programming examples do not work properly Got it working. Now I only need to find out: is COM 0 now UART0 or UART1 on the Pi 3 |
Timo Hartong (2813) 204 posts |
Made a start of writing the module in C with the toolkit. So the work has started. However this is the first module in C so bare with me. I did choose C because it is more readable then Assembler. If the module works I will have a look to have in the HAL ( Or not ;-)). |
Steve Pampling (1551) 8172 posts |
Very small point of English language use: |
John Williams (567) 768 posts |
I know you’re a cat person, Steve, but this lunchtime, after French class. the dog went for a quick run on a small patch of beach, and cavorted merrily. Wife said “he likes the sand under his bare feet – paws”: I responded “His bear paws!”, as his paws do indeed resemble those of a bear (his claws need trimming!)! No more relevant to the topic, but somehow fitted in! |
Clive Semmens (2335) 3276 posts |
Bear paws – it’d be an odd dog whose paws resembled those of a bear. Here’s a bear paw print in the sand by the river at the edge of my in-laws’ farm: |
Rick Murray (539) 13850 posts |
Bare – small fur-less (except patches, mostly at the top) humanoid shaped life form usually found in a non-bare state due to a female variant being tempted by a snake (it’s a long story). Bear – somewhat larger furry humanoid shaped life form well known for defecating in wooded areas. For some reason not clearly understood, the fur-less humanoids from the left side of the planet appear to have an obsession with bear arms, though anybody who has ever fought a bear and survived (Chuck Norris, Russian presidents…) might tell you that their legs and teeth are just as deadly… |
mikko (3145) 123 posts |
I’m looking forward to seeing the fruits of your efforts, Timo! |
Steve Pampling (1551) 8172 posts |
Sometimes you wish you hadn’t… I have no wish to distract Timo from a worthy item of work because of a trivial twist in spoken/written English that really needs any discussion to continue in Aldershot. |
Timo Hartong (2813) 204 posts |
Yes I do apologize my English writing is horrible. |
Steve Pampling (1551) 8172 posts |
Actually, no it isn’t. It’s actually better than people I know who were born here. |
Clive Semmens (2335) 3276 posts |
I’ll second that. And far, far better than our second languages, those of us who have any at all. |
Timo Hartong (2813) 204 posts |
So last evening during the evening of the Big Ben Club in Delft ( The Netherlands ) I continued work on the module for the Mini UART for the RPi. Searched and found some interesting source code and made some progress. Yes better copy ( if allowed ) good developed source code then write yourself bad code. Interesting enough the Mini UART is very close to the SPI so perhaps make one good header file for it. |
Timo Hartong (2813) 204 posts |
@Lothar: Slowly comming there. Although it is written in C |