|
| 1 | +# Bring-up |
| 2 | + |
| 3 | +This project helps checking if an MCU communicates with an OSP node. |
| 4 | + |
| 5 | + |
| 6 | +## Introduction |
| 7 | + |
| 8 | +When bringing up an OSP based system, the first hurdle is to get communication |
| 9 | +established, most notably between the MCU and the first node. The obvious |
| 10 | +way to detect successful communication is to switch on an LED of the node. |
| 11 | + |
| 12 | +However, this requires not only successful communication, but also a correct |
| 13 | +sequence of telegrams (assign address, clear errors, switch to active state, |
| 14 | +set drive current, set PWM value). |
| 15 | + |
| 16 | +In this sketch we just send a RESET telegram to one node, and check whether |
| 17 | +that node forwards it. |
| 18 | + |
| 19 | +An optional next step is sending INITBIDIR. Remember that a node needs |
| 20 | +150 μs for executing a RESET; a delay for that needs to precede the |
| 21 | +INITBIDIR telegram. |
| 22 | + |
| 23 | + |
| 24 | +## Hardware |
| 25 | + |
| 26 | +The demo runs on the OSP32 board. We cut a MiniBridge cable in two, plug it |
| 27 | +in OUT, add a pull-up on SION and SIOP, and connect a logic analyzer. |
| 28 | +An alternative is to use the OUT pin header to solder a header or even |
| 29 | +directly pull-ups. Recommended pull-up value is 10kΩ. |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | +The two pull-ups configure the port for USE mode (aka CAN mode). |
| 34 | +Unlike the standard LVDS mode, this uses voltage levels to communicate, |
| 35 | +so easier to capture using a logic analyzer. |
| 36 | + |
| 37 | + |
| 38 | +## Logic analyzer |
| 39 | + |
| 40 | +We used a [Saleae](https://www.saleae.com/) logic analyzer. |
| 41 | +It even has a slicer for Manchester. These are the settings for the slicer. |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | +## Software |
| 47 | + |
| 48 | +Run the `aospi_bringup.ino` sketch (compile for "ESP32S3 Dev Module" and upload). |
| 49 | +It will send a RESET and INITBIDIR every second. Arm the Saleae for a capture |
| 50 | +to create a trace. The resulting [trace](extras/trace.sal) has two telegrams, |
| 51 | +one for RESET, one for INITBIDIR. |
| 52 | + |
| 53 | + |
| 54 | +## RESET trace |
| 55 | + |
| 56 | +The first trace captures the RESET telegram. |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | +The MCU sends `A0 00 00 22` to SIO1 of the node, and we see that the |
| 61 | +node indeed forwards the same bytes to the (non-existent) next node. |
| 62 | +We can use `OSP_aospi\python\telegram` to draw the telegram. |
| 63 | + |
| 64 | +``` |
| 65 | +(env) OSP_aospi\python\telegram>run A0 00 00 22 |
| 66 | + +---------------+---------------+---------------+---------------+ |
| 67 | +byteval | A0 | 00 | 00 | 22 | |
| 68 | +byteix |0 0 0 0 0 0 0 0|1 1 1 1 1 1 1 1|2 2 2 2 2 2 2 2|3 3 3 3 3 3 3 3| |
| 69 | +bitix |7 6 5 4 3 2 1 0|7 6 5 4 3 2 1 0|7 6 5 4 3 2 1 0|7 6 5 4 3 2 1 0| |
| 70 | +bitval |1 0 1 0 0 0 0 0|0 0 0 0 0 0 0 0|0 0 0 0 0 0 0 0|0 0 1 0 0 0 1 0| |
| 71 | + +-------+-------+-----------+---+-+-------------+---------------+ |
| 72 | +field |preambl| address | psi | command | crc | |
| 73 | +bin | 1010 | 0000000000 | 000 | 0000000 | 00100010 | |
| 74 | +hex | 0xA | 0x000 | 0x0 | 0x00 | 0x22 (ok) | |
| 75 | +meaning | - | broadcast | 0 | reset | 34 (ok) | |
| 76 | + +-------+-------------------+-----+-------------+---------------+ |
| 77 | +``` |
| 78 | + |
| 79 | +This proves that the node is operational: it receives a telegram from the MCU |
| 80 | +and processes it (forwards it). |
| 81 | + |
| 82 | + |
| 83 | +## INITBIDE trace |
| 84 | + |
| 85 | +Even more convincing is the trace of the INITBIDIR. |
| 86 | +The MCU sends `A0 04 02 A9` to SIO1, this means INITBIDIR(001), |
| 87 | +i.e. init and assign yourself address 001 |
| 88 | + |
| 89 | +``` |
| 90 | +(env) OSP_aospi\python\telegram>run A0 04 02 A9 |
| 91 | + +---------------+---------------+---------------+---------------+ |
| 92 | +byteval | A0 | 04 | 02 | A9 | |
| 93 | +byteix |0 0 0 0 0 0 0 0|1 1 1 1 1 1 1 1|2 2 2 2 2 2 2 2|3 3 3 3 3 3 3 3| |
| 94 | +bitix |7 6 5 4 3 2 1 0|7 6 5 4 3 2 1 0|7 6 5 4 3 2 1 0|7 6 5 4 3 2 1 0| |
| 95 | +bitval |1 0 1 0 0 0 0 0|0 0 0 0 0 1 0 0|0 0 0 0 0 0 1 0|1 0 1 0 1 0 0 1| |
| 96 | + +-------+-------+-----------+---+-+-------------+---------------+ |
| 97 | +field |preambl| address | psi | command | crc | |
| 98 | +bin | 1010 | 0000000001 | 000 | 0000010 | 10101001 | |
| 99 | +hex | 0xA | 0x001 | 0x0 | 0x02 | 0xA9 (ok) | |
| 100 | +meaning | - | unicast(1) | 0 | initbidir | 169 (ok) | |
| 101 | + +-------+-------------------+-----+-------------+---------------+ |
| 102 | +``` |
| 103 | + |
| 104 | +The outgoing telegram is different. |
| 105 | + |
| 106 | + |
| 107 | + |
| 108 | +We see the bytes `A0 08 02 F9`; when we plot that we get the following diagram. |
| 109 | + |
| 110 | +``` |
| 111 | +(env) OSP_aospi\python\telegram>run A0 08 02 F9 |
| 112 | + +---------------+---------------+---------------+---------------+ |
| 113 | +byteval | A0 | 08 | 02 | F9 | |
| 114 | +byteix |0 0 0 0 0 0 0 0|1 1 1 1 1 1 1 1|2 2 2 2 2 2 2 2|3 3 3 3 3 3 3 3| |
| 115 | +bitix |7 6 5 4 3 2 1 0|7 6 5 4 3 2 1 0|7 6 5 4 3 2 1 0|7 6 5 4 3 2 1 0| |
| 116 | +bitval |1 0 1 0 0 0 0 0|0 0 0 0 1 0 0 0|0 0 0 0 0 0 1 0|1 1 1 1 1 0 0 1| |
| 117 | + +-------+-------+-----------+---+-+-------------+---------------+ |
| 118 | +field |preambl| address | psi | command | crc | |
| 119 | +bin | 1010 | 0000000010 | 000 | 0000010 | 11111001 | |
| 120 | +hex | 0xA | 0x002 | 0x0 | 0x02 | 0xF9 (ok) | |
| 121 | +meaning | - | unicast(2) | 0 | initbidir | 249 (ok) | |
| 122 | + +-------+-------------------+-----+-------------+---------------+ |
| 123 | +``` |
| 124 | + |
| 125 | +Note that the outgoing telegram is INITBIDIR(002), so we see that the |
| 126 | +node has actively transformed the incoming telegram: stepped the address, |
| 127 | +and recomputed the checksum. |
| 128 | + |
| 129 | +This means we have successful MCU-SAID communication. |
| 130 | + |
| 131 | + |
| 132 | +## Afterthought |
| 133 | + |
| 134 | +There are many things that can go wrong. See this libraries readme for a list |
| 135 | +of [issues](https://github.com/ams-OSRAM/OSP_aospi?tab=readme-ov-file#issues). |
| 136 | + |
| 137 | +(end) |
0 commit comments