Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FrameLength issue #58

Open
BRolandG opened this issue Aug 29, 2024 · 10 comments
Open

FrameLength issue #58

BRolandG opened this issue Aug 29, 2024 · 10 comments

Comments

@BRolandG
Copy link

Hi

Something is wrong here.

I'm trying to sync 2 engines rpm with ESP32 (v2.0.17). Futaba T32MZ and R7008SB, only receiving channels and slots.

The display in the logg comes from Serial.print in the cpp file. I just removed the /*.

I have WDT set to panic after 1 sek.

Bernt

logg.txt
TweenEngineSyncSbus2.zip

@ericlangel
Copy link
Collaborator

Hi Bernt,

i know we already talked about your project.
Could you just share in some words what you are trying?

2 engines -> each engine has its own original futaba rpm sensor? (or more than one?)
and you are controlling the slave engine from ESP32 based on the received RPM Values?

anything else attached on the SBUS2?

@BRolandG
Copy link
Author

BRolandG commented Aug 29, 2024 via email

@BRolandG
Copy link
Author

BRolandG commented Aug 29, 2024 via email

@ericlangel
Copy link
Collaborator

ok, now we should break some things down:

are the 5 Sensors are working (without the ESP32) and you can see them with correct values in your T32MZ?
Which Slots are they using?

Are the Servos SBUS or SBUS2 types? i think there exist SBUS2 Servos which act like a sensor.....bur i'am not sure.

can you make a Quick & dirty esp32 sketch which is just reading the Sensor values? For example my Read Telemetry example?

@BRolandG
Copy link
Author

BRolandG commented Aug 29, 2024 via email

@ericlangel
Copy link
Collaborator

ok, at which point does the esp crash?

Error! -> rx_fifo_len = 6 Value = 83, DB, 2, 1E, D4, FE, 27, [HEX]
Error! -> rx_fifo_len = 29 Value = 83, DB, 2, 1E, D4, FE, 27, BA, 6D, 84, 85, B1, A0, 6, B, 63, 1, 8, 40, 0, 82, 5, 80, 0, 4, 0, 0, 0, 0, 0,

these Errors are not nice, but it can happen.
if it is happen every 1000 Frames....doesnt matter
it its happen every 100 Frames.....ok not nice
if its happen every 10 Frames....you should worry

but it should never cause a crash.

so please tell me when does it happen and how often?
and....you shouldnt do Serial print in the UART handler (without knowing waht you do)...it could cause the crash.

@BRolandG
Copy link
Author

BRolandG commented Aug 29, 2024 via email

@ericlangel
Copy link
Collaborator

oh......Ok.

i think i got it.

So maybe some explaining:
the UART handler is executed when 25 Byte or more are in UART buffer (after a Frame) or after a timeout without new received bytes (after a sensor Slot with 3 bytes).

if there are not 25 or 3 Bytes in the UART buffer -> something is wrong and UART buffer needs to be cleared.
this should be done by uart_flush(uart_num);

  1. thing
    dont Serial.print "Error! -> rx_fifo_len = 6 Value = 83, DB, 2, 1E, D4, FE, 27, [HEX]"
    it's based on rxbuf which is 30Bytes big. if you try to print byte 31 something wired will happen

  2. thing
    we should clear the UART buffer manual right before uart.flush()
    while(rx_fifo_len){ rxbuf[buffer_index] = UART1.fifo.rw_byte; // read all bytes rx_fifo_len--; buffer_index++; }

this should solve the problem

@BRolandG
Copy link
Author

BRolandG commented Aug 29, 2024 via email

@ericlangel
Copy link
Collaborator

yes, this should work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants