I tried it out in the following situation. I have another device that I communicate to via UART so I hook it up to the AltSoftSerial pins 8 and 9 (plus a GND that the device needs). When it boots, it transmitts with the baudrate 115200 to give it's booting messages. Then once booting is completed, it switches to 9600 and expects the user to hit enter. After that it switches back to 115200 and allows the user to login.
First you'll see the output when directly using the hardware UART pins of the Nano without any code on it.
U-Boot unifi-v1.6.7.249-gb74e0282 (Apr 25 2017 - 09:18:46)
DRAM:
sri
ath_ddr_initial_config(278): (ddr2 init)
ath_sys_frequency: cpu 775 ddr 650 ahb 258
.
.
.
(and so on and on till the following comes)
Starting kernel ...
(Then it suddenly changes to baud rate 9600 and waits for me to hit Enter)
[00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00]
(When I hit enter with 9600 and change back to 115200, and type anything in the CLI, I get this login window and can successfully use it)
mesh3 login: admin
admin
Password: (not gonna tell you guys, sorry)
BusyBox v1.19.4 (2017-03-22 15:29:31 PDT) built-in shell (ash)
Enter 'help' for a list of built-in commands.
BZ.v3.7.51# ifconfig
ifconfig
ath1 Link encap:Ethernet HWaddr F0:9F:C2:3E:A1:74
UP BROADCAST RUNNING PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
.
.
.
(and so on)
BZ.v3.7.51#
Then I use the following code on the arduino nano to communicate with the device via the AltSoftSerial pins 8 and 9 with this code:
#include <AltSoftSerial.h>
//Software-UART Pins for UniFi AC M
AltSoftSerial unifi_serial; // RX = Pin8, TX = Pin9
//Variable used to measure the time for the UniFi AC M to boot
unsigned long tmp;
void setup() {
Serial.begin(115200);
while (!Serial) { } // Wait for Serialport
unifi_serial.begin(115200);
Serial.println("Initialize communication. Please wait...");
}
void loop() {
do{
//Input, that arrives from UniFi AC M is being transmitted to Serial
if (unifi_serial.available()) {
Serial.write(unifi_serial.read());
}
tmp = millis();
}while (tmp < 50000); //wait for UniFi to boot
//Change baudrate to 9600
unifi_serial.flush();
unifi_serial.begin(9600);
delay(3000);
//Sending "Enter"
unifi_serial.write('\n');
delay(3000);
//Change baudrate back to 115200
unifi_serial.flush();
unifi_serial.begin(115200);
Serial.println("\n\nInitialization completed");
while (1) {
//Input, that arrives via Serial is being transmitted to UniFi AC M
if (Serial.available()) {
unifi_serial.write(Serial.read());
}
//Input, that arrives from UniFi AC M is being transmitted to Serial
if (unifi_serial.available()) {
Serial.write(unifi_serial.read());
}
}
}
It also works somehow but the answer of the device often is some trash. I don't know why. Maybe the buffer is full or anything? if the changing of the baudrate didn't work, then I shouldn't be possible to login at all? Here the output with the AltSoftSerial code:
Initialize communication. Please wait...
€
[0C]
[15]-B`ot u[0E]ifi-v1.6.7.249-gb74e0282 (@É25 2017 - 09:18:46)
DRAL:
sri
a[17]ëEDÉ}¤¹¥Ñ¥…±}Œ½¹™¥¡278): (ddr2 init)
ath_pys_frequency: cpu 775 ddr 650 a[08]b 258
.
.
.
(and so on and on till the following comes)
StartZèkernel ...
[00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00]
Initialization completed
[0E][00]¡¬X.k[02][00]login:[00]þadmin
admin
[00]áPassword:[00](not gonna tell you guys, sorry)
[00]á
[00]¡ [00]H[15]Íå ¾áÿ²ÁrŠÊr¢[02][00](2[00]Šºj‚šz’’[02][00]15[00]'[00]ÊÒšŠ[02][00]PD\)[00][12]Ô½±Ñ·in she[0C][00][0B]B
4[08]([00]z
Fnter '[00]«[16], [00]ÖK [00]+[00][04]ˆ[08]z™€built-[00]Z[0B][1A]ô¨+뿑̹
[00]¡ [00]Hi¹v3[00]驎[1A][00] ifconfig
ifconfig
[00]áath1[00][02][00] [00][02][00] [00]
Èk[0B]*äh…p:[00]Q[10]«É¹•Ñ [00]ú[14]‘ÉF0[00]§N”[1A]ÉÒš*é
.
.
(and so on)