JohnQPublic Posted November 20, 2018 Posted November 20, 2018 I have OrangePi PC and I'd like to use HC-12 serial communications device. I've successfully used it with RaspberryPi Zero with these instructions: http://dev.drun.net/2017/05/10/reading-hc-12-from-rpi-and-sending-to-domoticz/ I've found this useful info: https://forum.armbian.com/topic/1524-orange-pi-one-how-to-enable-uart/ I've connected the HC-12 to OPPC as follows: VIN – Connect to 3.3 (PIN 2) GND – Connect to GND (PIN 6) RX – Connect to (PIN 8, UART0_TXD) TX – Connect to (PIN 10, UART0_RXD) I've got Putty connected to OrangePi. command "ls /dev/tty*" shows that I have /dev/ttyS0. I've tried to use it with Minicom: sudo minicom -b 9600 -o -D /dev/ttyS0 ..to no avail. "uname -a" command shows "Linux orangepipc 3.4.113-sun8i #68 SMP PREEMPT Wed Sep 19 10:23:30 CEST 2018 armv7l armv7l armv7l GNU/Linux" I opened the script.fex and it shows: Quote [uart0] uart_used = 1 uart_port = 0 uart_type = 2 uart_tx = port:PA04<2><1><default><default> uart_rx = port:PA05<2><1><default><default> [uart1] uart_used = 0 uart_port = 1 uart_type = 4 uart_tx = port:PG06<2><1><default><default> ...etc. I have no clue what these mean. The first useful info above mentions that I should modify them. What should I try next?
martinayotte Posted November 20, 2018 Posted November 20, 2018 1 hour ago, JohnQPublic said: RX – Connect to (PIN 8, UART0_TXD) TX – Connect to (PIN 10, UART0_RXD) If you look at OPiPC schematic, the Pin 8/10 are not UART0 but UART3, UART0 is connected on 3 pins Serial Debug header and used by kernel to output debug logs, so usable for your HC-12. so in your script.fex, it should be present and "uart_used" should be 1 not 0 to activate it at next reboot. 1 hour ago, JohnQPublic said: command "ls /dev/tty*" shows that I have /dev/ttyS0 UART3 should then be accessible as /dev/ttyS3 ...
JohnQPublic Posted November 21, 2018 Author Posted November 21, 2018 Thank you for your reply. Just to clarify. I'd rather not change script.bin in fear I mess something. If I connect the RX and TX wires from the HC-12 to the 1+2 (GND, RX,TX) pins next to the HDMI connection (should ground be connected as well?) can I leave script.bin as it is? Will it affect Putty? If If have to change: [uart1] uart_used = 0 -> [uart1] uart_used = 1 will I then have "/dev/ttyS1" available. Where shoul the HC-12 RX/TX wires then go?
martinayotte Posted November 21, 2018 Posted November 21, 2018 8 hours ago, JohnQPublic said: If I connect the RX and TX wires from the HC-12 to the 1+2 (GND, RX,TX) pins next to the HDMI connection (should ground be connected as well?) can I leave script.bin as it is? But your HC-12 will receive a lot of junk since the kernel will output log there, especially at boot time. But you can try ... (be aware that this one is /dev/ttyS0) 8 hours ago, JohnQPublic said: [uart1] uart_used = 1 to the HDMI connection (should ground be connected as well?) can I leave script.bin as it is? UART1 on OPiPC is pin38/40, but simply edit script.fex doesn't do anything until you recompile it as script.bin (make sure to backup original)
JohnQPublic Posted November 21, 2018 Author Posted November 21, 2018 OK gathered enough courage to edit script.fex and compile it to script.bin and then reboot: [uart3] uart_used = 1 uart_port = 3 uart_type = 4 uart_tx = port:PA13<3><1><default><default> uart_rx = port:PA14<3><1><default><default> I have HC-12 RX wire going to Orangepipc pin 8 (PA13 TX) and HC-12 TX wire going to Orangepipc pin 10 (PA14 RX) Now sending using /dev/ttyS3 appears to work, but receiving not. What could be the problem? Other Orange Pi PC features seem towork fine (Putty, net etc)
martinayotte Posted November 22, 2018 Posted November 22, 2018 On 11/21/2018 at 8:46 AM, JohnQPublic said: Now sending using /dev/ttyS3 appears to work, but receiving not. What could be the problem? I don't have much ideas : are you sure you didn't mix TX and RX ? If you pull down the "SET" pin, do you have answers when sending an AT command ?
JohnQPublic Posted November 22, 2018 Author Posted November 22, 2018 I'll try to figure it out. I just want to thank you for you help.
Recommended Posts