wernerdaehn / CC3D-CableCam-Controller

CC3D and STM Cube based CableCam controller
Apache License 2.0
37 stars 15 forks source link

Bluetooth connection FLIP 32 and HC-06 #27

Closed DmitriySurin closed 5 years ago

DmitriySurin commented 5 years ago

I have HC-06 manually programmed to: AT OK AT+UART +UART:38400,0,0 OK AT+NAME +NAME:cablecam OK AT+PSWD +PIN:"1234" OK AT+VERSION VERSION:3.0-20170609 OK

But it doesnt work for FLIP.

wernerdaehn commented 5 years ago

That +UART:38400,0,0 worries me. Can you change the settings to UART 38400,1,0? It should have no parity, one stop bit.

DmitriySurin commented 5 years ago

No it doesnt help

wernerdaehn commented 5 years ago

I have uploaded a firmware version with debugging support for the bluetooth UART.

As said, this for monitoring the RX pin on the UART3 of the controller.

I hope this helps us isolating the issue.

DmitriySurin commented 5 years ago

I send 123456 via Serial bluetooth terminal and I can see very strange result in your debugging mode:

Bluetooth debug: ON ▒▒▒▒

DmitriySurin commented 5 years ago

Also $d B said:

Bluetooth UART's last error code flag says: no errors

wernerdaehn commented 5 years ago

That does not make sense. Sending different characters resulting in the same target character without frame or parity error is impossible. Something is wrong. What I would do next is connect the PC via a USB-to-UART adapter to the cablecam controller's bluetooth pins (without 5V) and proof the UART is fine or not.

DmitriySurin commented 5 years ago

What I would expect to see in terminal? At? Or what?

wernerdaehn commented 5 years ago

If you send "123456" to the UART, in the USB terminal you would see "123456".

I have added a print statement into the UART3 receiver logic. Before the received char is put into the UART buffer, it is also sent to the USB terminal.

        void UARTX_IRQHandler(UART_HandleTypeDef *huart) {
            if (controllerstatus.bluetooth_passthrough) {
                PrintSerial_char(byteReceived, EndPoint_USB);
            }
            huart->pRxBuffPtr[huart->RxXferCount % huart->RxXferSize] = byteReceived;
            huart->RxXferCount++;
        }
DmitriySurin commented 5 years ago

Ok. I cheked it. Thats works. Flips UART is fine!

DmitriySurin commented 5 years ago

I bought HC-05, and now everything is work fine.