riptidewave93 / LEDE-MR33

Bringup for the Cisco Meraki MR33 Access Point on LEDE
70 stars 7 forks source link

Cheers UART issues? #7

Closed jebuskrust closed 6 years ago

jebuskrust commented 6 years ago

Had to use the USB 2.0 to TTL UART 6Pin CP2102 Module (3$ on wish) with my pi 3 instead to install.

Although uart functioning was working with what's built into the pi 3 , The built in serial on the pi 3 gave me many issues, (random disconnects, etc) .. strongly recommend the 3$ module instead.

This issue I fixed myself but thought I'd report it anyway.

Everything is up and running, thanks

chunkeey commented 6 years ago

Hm, one issue with the (main) uart on PCs/SoC running linux is that the cmdline (or /etc/inittab) might start a getty/atty console on them too. So, the outputs from the MR33 are interpreted as keystrokes on the PC/RPI and the login (getty) / shell interprets them as login-credentials or commands. And of course failure messages (output of the PC/RPI) get sent to the MR33.

jebuskrust commented 6 years ago

That's exactly what I was observing. Makes sense too. Thanks. Only issue I'm having now is whenever I bring up hci0, the unit freezes.

The hciattach command works without issue (i have a /dev/ttyMSM0 and a /dev/ttyMSM1) . It's not a big deal though but still would be cool to play with bluetooth 💃 . I installed the dependencies based off of what was listed in the commit changes. I'm assuming this commit isnt present in the latest snapshots which is probably why it's not working, may need to build from source instead.... However, Running current stable

Here's the commit i followed https://github.com/riptidewave93/LEDE-MR33/commit/43ca7f34e0437ef9384fc38f1c4de6a843f1dd98

Woohoo image

image

chunkeey commented 6 years ago

Only issue I'm having now is whenever I bring up hci0, the unit freezes.

The hciattach command works without issue (i have a /dev/ttyMSM0 and a /dev/ttyMSM1). It's not a big deal though but still would be cool to play with bluetooth dancer . I installed the dependencies based off of what was listed in the commit changes. I'm assuming this commit isnt present in the latest snapshots which is probably why it's not working, may need to build from source instead....

Oh, let me explain what's going on with that. But please bear in mind that I played around with the BLE chip a long time ago, so this is all from memory (and there might be some gaps/errors):

The cc2650 (in the Meraki) is not a full bluetooth chip. It only supports bluetooth >LE< and needs a firmware to switch between the client/server modes.

the (current) bluez tools (hcitool/hciattach/...) do not really support these pure/only bluetooth LE chips. That's why, if you look into the original meraki MR33 firmware, you'll see that Meraki made custom tools (blescan) to deal with these devices.

If you want to play around with the BLE chip (as client/host), you should get the firmware from: the diagnostics1 image under lib/firmware/cc2650 and use cc2538-bsl.py to upload it via: (Be advised: the BLE MCU might need to be put into (and out) of RESET - this is controlled through a GPIO - see the usr/sbin/senao_upgrade_BLE_OS.sh script in the diagnostic1 image ).

MR33# ./cc2538-bsl.py -e -w -v -b 115200 -p /dev/ttyMSM1 /lib/firmware/cc2650/HostTest_4x4_XD_PS_BD.hex
Opening port /dev/ttyMSM1, baud 115200
Connecting to target...
*** sending synch sequence
[...]
CC2650 PG2.3 (4x4mm): 128KB Flash, 20KB SRAM, CCFG.BL_CONFIG at 0x0001FFD8
[...]

and then you have to use something like Python-for-TI-CC2540 (change the ttyACM0 in bluetooth.py to ttyMSM1 and the baudrate to 115200) to do something useful with the chip (i.e. scan for other Bluetooth LE devices) or connect to a BLE device, etc...). Note: There's also bluepy which is probably a much better foundation to use. But I never got around to play with it...

As you can see, this BLE stuff involves quiet a bit of work and you are limited to just Bluetooth LE and the python apps.

jebuskrust commented 6 years ago

Thanks for the information, I nuked that partition. 👍 Go me.. Guess I wont ever be playing with it now 😆 I'm pretty sure that hex is device specific 🤣 not a big deal though, don't really need it. The wireless radios are everything else works, that's all I really needed

chunkeey commented 6 years ago

Thanks for the information, I nuked that partition. +1 Go me.. Guess I wont ever be playing with it now laughing I'm pretty sure that hex is device specific rofl not a big deal though, don't really need it. The wireless radios are everything else works, that's all I really needed

Actually, I don't know if it is necessary or not to use the cc2538-bsl.py tool. The MR33 I got came "pre-modified". Based on the usr/sbin/senao_upgrade_BLE_OS.sh script, the chip gets programmed with the HostTest_4x4_XD_PS_BD.hex during Meraki's firmware installation. So, you could try the Python-for-TI-CC2540 tool and see what happens.

jebuskrust commented 6 years ago

Thanks will definately try that.

Installed python and the pyserial dependency, will see if it works when I get home.

image

Also this..

http://www.ti.com/tool/ble-stack http://www.ti.com/tool/SIMPLELINK-CC2640R2-SDK http://www.ti.com/tool/flash-programmer

kylegordon commented 6 years ago

Interesting stuff @chunkeey - thank you for the information!

I note that the CC2650 is, maybe, software defined, in that TI list 6LowPAN, Zigbee and BLE in the capabilities list. Do you reckon there's much chance of the chip being usable as a Zigbee member?

chunkeey commented 6 years ago

@jebuskrust hm, looks a bit barren. Do you have a BLE device somewhere in range? It should show up.

@kylegordon Well, This is the CC2650 4x4 Datasheet . However I'm not sure if everyone groks the "Can Run Autonomous From the Rest of the System" part though. This CC2650 is supposed to run independent from the rest of the system. Sort of like a cut-down ESP32 but with only Bluetooth LE OR 802.15.4 at a time (due to different firmwares). As for using 6LowPAN, I didn't get the change to play with it. From what I understand the way to go would be through Conitiki (i.e.: http://yplam.com/embedded/2016/02/23/configuring-6lbr-ubuntu-sensortag-cc2650.html - I reckon that some lateral thinking is required in order to port this to the MR33 and its cc2650 ). Note: If someone figures this out, please add a paragraph about to the wiki. Thanks!

Anyway, for anyone (still) interested in BLE please also check out the: Host_Test Readme.It contains valuable information like this: "Note: It is not possible to use an external Bluetooth Host stack, such as BlueZ, with Host Test since the network processor implements the Host component. External applications must use the TI Vendor Specific HCI commands for implementing GAP, GATT, Pairing/Bonding, etc., functionality." (The source for this Host_Test firmware is supposedly provided by Ti's BLE SDK - which can be downloaded from Ti's website).

jebuskrust commented 6 years ago

@chunkeey didnt have time last night! Probably wont have time till this weekend.

chunkeey commented 6 years ago

well if you get around this is what it could look like:

root@stinkbug:~/Python-for-TI-CC2540# ./bluetooth.py 
Connected to Dongle
Sent device init command!

Starting Read loop
        ======================
        Found Vendor Specific Event Code
        Data length :6 Data Code :1663
        [1]:65024 [2]:0
        Dongle recieved GAP_deviveInit command
        ======================
        Found Vendor Specific Event Code
        Data length :44 Data Code :1536
Got Device init done
Device initialized and ready
Dongal Address :0x834... 
        ======================
    Found Vendor Specific Event Code
    Data length :4 Data Code :1537
            Devices Discovery Done, found 0 Devices

d
Doing Discovery
    ======================
    Found Vendor Specific Event Code
    Data length :6 Data Code :1663
    [1]:65028 [2]:0
    Dongle recieved command GAP Device Discovery Request
    ======================
    Found Vendor Specific Event Code
    Data length :44 Data Code :1549
    GAP Device information
            Device d5d10250ffff responded to discovery with 020106030212180319c40313094d6167696e6f6e2d56522020202020202020 (reverse)
    ======================
    Found Vendor Specific Event Code
    Data length :12 Data Code :1537
            Device Discovery Done, found 1 Devices
{0: {'AddrType': 0, 'BinAddr': '\xd5\xd1\x02P\xff\xff', 'Addr': 'd5d10250ffff', 'EvType': 0}}

The device I was testing with was a something like these BLE VR remote.

And the output (MAC) matches that of a real bluetooth device:

 laptop-with-bluetooth# hcitool lescan
 LE Scan ...
 FF:FF:50:02:D1:D5 Maginon-VR
 FF:FF:50:02:D1:D5 (unknown)

(Anyway, I think the BLE chip deserves its own thread by now - what do you think? It's probably best if you start another issue with a matching subject. )

jebuskrust commented 6 years ago

Had some time tonight, still issues.. Opening up a new thread Bluetooth related.

jebuskrust commented 6 years ago

There we go, created something.. now I have to put the kid down to rest :(

Have a great one guys.