BrushlessPower / SBUS2-Telemetry

Arduino Library for SBUS and SBUS2 with Futaba Telemetry
GNU General Public License v3.0
86 stars 24 forks source link

How do you login your Arduino as a sbus2 device to your remote controller? #47

Closed kevinuav closed 2 years ago

kevinuav commented 2 years ago

Hi, Thank you for your work on the sbus2. But I don't see any code for logining ro the remote controller. Since every sbus2 device should be login to the remote controller by plugging the sensor into the remote controller first. Or it can't be display on the sensor's interface screen. How do you overcome for the problem?

ericlangel commented 2 years ago

hi @kevinuav me and @BrushlessPower have no acces to the "login protocol". And it is not necessary.

normal login: the Sensor needs a Slot Nummer to send his telemetry. So remote Control is looking for a free Slot and set the Slot Number in the Sensor.

Manual Login: You can set your Sensors manually in your Remote Control. You just have to tell your Code which Slot Numbers are used for which Sensor.

if you have problems, please post your Remote Control type. I can help you with T14SG and i think its similar to other models.

kevinuav commented 2 years ago

Hi,my remote controller is T18SZ. the receiver is R3001SB. I wanna get all my remote controller's control value and send back my telemetry data with just connecting a sbus2. Is sbus2's timing sequence equals sbus1 + the telemetry slots? So that I can read the control value as a sbus1 protocol. Then send back the telemetry data with the slots?

BrushlessPower commented 2 years ago

@kevinuav

please look at the Examples. The "Futaba_Telemetry" Example does exactly what you want

you can get your Channel Values with: SBUS2_get_servo_data( 2 ); -> Example for Channel 2

Were you able to set your Sensors manually in your T18SZ?

kevinuav commented 2 years ago

Hi,Thank you for your help. I inspect the sbus2 signal with the logic analyser. And I noticed a odd place. The every frame which ends with 0x04 comes with 3bytes. what are they? And BTW. Could I send my message directly after the 0x04(slot0-7),0x014(slot8-15).......... without any other operation?

截屏2022-03-23 下午3 58 39 截屏2022-03-23 下午3 58 21
ericlangel commented 2 years ago

0x04 is Frame No.1 After Frame No. there comes SLOT 0- 7

0x03, 0xC4 and 0x00 -> is Slot 0 = Receiver Voltage

No, you cant send your SLOTS directly after the Frames. There are some strict Timings needed.

What are you trying to do? Do you want to port the library to another MCU?

kevinuav commented 2 years ago

Yeah I wanna transplant the code to STM32F7.

ericlangel commented 2 years ago

soneone already asked in #32 for STM32 Support

Do you want to code it Bare Metal on Registers? Or with HAL - Arduino functions to make it usable for other STM32?

You just need 2 things:

After receiving the SBUS Frame (25Bytes) start the Timer with 2000ms in Timer Interrupt, send SLOT Data and start the Timer again with 660ms (repeat 6 times)

the Rest is easy

kevinuav commented 2 years ago

Got it! I wanna port it to my STM32F7. But I still have a question about sbus2. Why the receiver's voltage data comes out from the receiver since the telemetry is sending back the data from sensor to RC? The direction of the data stream should be sensor->receiver->RC. However the data stream I got from logic analyses is receiver->sensor. Dose it work like this: receiver->sensor->receiver->RC? This confuses me. And could I send the Telemetry data after the receiver voltage?

ericlangel commented 2 years ago

i think you have to ask Futaba, why they have the RX Voltage available on the SBUS2.

You can Send Slot 1 320ms after Slot 0 (RX Voltage) Your Timer have to do it. Let the Timer work also on Slot 0.

  1. you can check the timing (toggle a pin on each timer interrupt)
  2. you will need it for Slot 8, 16 and 24.

just dont set any Sensor on Slot 0. This Library will do the rest for you

kevinuav commented 2 years ago

OK. thank you for your help.

ericlangel commented 2 years ago

please share your code when you are finished, or come back when you have problems

and we should continue in #32

kevinuav commented 2 years ago

Hi, Thanks for you help. I can send back the data for the average slot. But the jetcat's and the GPS's. Why? Aren't the GPS's and the jetcat's slots the same as the average?

ericlangel commented 2 years ago

@kevinuav what is the average Slot? i dont understand what you are saying.

p.s. could you get it working with STM32?

kevinuav commented 2 years ago

Not yet. I can send back the message for the first frame. But the other frames since the function" write" cost me 4ms. So the GPS and the jetcat can never been receive correct.

ericlangel commented 2 years ago

why you want to receive the jetcat and gps sensor? you should write them?

So if i understand you correctly, you are receiving the SBUS Frames with USART Interrupt? do you receive every Frame? Did you set up the timer to fire on every Slot? for the first stuff you dont need to Send telemetry Data. Just toggle a LED in the Timer interrupt to see an the Scope/logic analyser that the timing is correct.