Re: SBUS decoder, display, and wireless buddy box project
Posted: 23 Jun 2020, 07:24
I found that the X-Boss receiver SBUS output is not as good as the much older Orange receiver I was using for initial testing.
The 8E2 serial format at 100kbaud means that each byte, sent as 12 bits, (one start bit, eight data bits, one parity bit, two stop bits) occupies 120 microseconds. There are 25 bytes in a frame so although a frame may only be sent every 20 milliseconds the actual frame data should take 25 x 120 = 3000 microseconds.
...And the Orange receiver does exactly that, so I wrote my code to time out after 3120 microseconds, assuming that it had missed a packet... and that timeout never actually occurred unless the receiver was powered down.
...But the X-Boss receiver puts random small pauses at random positions between bytes, so the 25 bytes take about 3500 microseconds to arrive - and my sketch was never receiving what it considered to be a good frame.
I've now extended my sketch timeout to 4000 microseconds and it's working fine with both receivers now. I've updated the sketch attached to the opening post.
The X-Boss receiver also doesn't send the 'Frame lost' or 'Failsafe' bits - but it does pack its received signal strength value into channel 16. This means that the transmitter can only send 15 real channels - but that should be plenty!
I couldn't find a way to pick up a non-inverted signal from the X-Boss receiver - the signal is probably there, but not anywhere that can be reasonably soldered to. For inverting the signal, I've swapped from using a bipolar NPN transistor with two resistors to an N-channel mosfet (2N7000). The mosfet is just a fancy transistor (and looks just like one) but it has the advantage of not needing a 'base' resistor, and saves a tiny amount of power. In fact, it works fine without a pull-up resistor on the drain too - so no resistors at all, though it isn't technically correct to operate without the drain pull-up.
The 8E2 serial format at 100kbaud means that each byte, sent as 12 bits, (one start bit, eight data bits, one parity bit, two stop bits) occupies 120 microseconds. There are 25 bytes in a frame so although a frame may only be sent every 20 milliseconds the actual frame data should take 25 x 120 = 3000 microseconds.
...And the Orange receiver does exactly that, so I wrote my code to time out after 3120 microseconds, assuming that it had missed a packet... and that timeout never actually occurred unless the receiver was powered down.
...But the X-Boss receiver puts random small pauses at random positions between bytes, so the 25 bytes take about 3500 microseconds to arrive - and my sketch was never receiving what it considered to be a good frame.
I've now extended my sketch timeout to 4000 microseconds and it's working fine with both receivers now. I've updated the sketch attached to the opening post.
The X-Boss receiver also doesn't send the 'Frame lost' or 'Failsafe' bits - but it does pack its received signal strength value into channel 16. This means that the transmitter can only send 15 real channels - but that should be plenty!
I couldn't find a way to pick up a non-inverted signal from the X-Boss receiver - the signal is probably there, but not anywhere that can be reasonably soldered to. For inverting the signal, I've swapped from using a bipolar NPN transistor with two resistors to an N-channel mosfet (2N7000). The mosfet is just a fancy transistor (and looks just like one) but it has the advantage of not needing a 'base' resistor, and saves a tiny amount of power. In fact, it works fine without a pull-up resistor on the drain too - so no resistors at all, though it isn't technically correct to operate without the drain pull-up.