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

Copter: CANFD data stream hangs up after couple of minutes. #26704

Closed
ketanatzebu opened this issue Apr 6, 2024 · 7 comments
Closed

Copter: CANFD data stream hangs up after couple of minutes. #26704

ketanatzebu opened this issue Apr 6, 2024 · 7 comments

Comments

@ketanatzebu
Copy link

ketanatzebu commented Apr 6, 2024

Bug report

Issue details

I have a proximity sensor giving out measurements via CANFD. I tried using lua script to read and process the frame but the sensor hangs up after few minutes. I have confirmed that it’s not an issue with the sensor using the CANFD analyzer on which I get uninterrupted continuous readings.

Nom Bit Rate: 1 000 000
Data Bit Rate: 5 000 000

Sensor: Ti mmwave AWR6843AOP

Version
Copter 4.5

Platform
[ ] All
[ ] AntennaTracker
[X] Copter
[ ] Plane
[ ] Rover
[ ] Submarine

Hardware type
Cube Orange Plus

Logs
------- Clock Config -------
CAN_CLK_FREQ: 80MHz
Std Timings: bitrate=1000000 presc=8
sjw=1 bs1=8 bs2=1 sample_point=90.00000%
FD Timings: bitrate=5000000 presc=1
sjw=4 bs1=11 bs2=4 sample_point=75.00000%
------- CAN Interface Stats -------
tx_requests: 0
tx_rejected: 0
tx_overflow: 0
tx_success: 0
tx_timedout: 0
tx_abort: 0
rx_received: 388
rx_overflow: 0
rx_errors: 0
num_busoff_err: 0
num_events: 388
ECR: FF00
fdf_rx: 388
fdf_tx_req: 0
fdf_tx: 0

@ketanatzebu ketanatzebu changed the title CANFD data stream hangs up after couple of minutes. Copter: CANFD data stream hangs up after couple of minutes. Apr 6, 2024
@IamPete1
Copy link
Member

IamPete1 commented Apr 7, 2024

How are you determining that it hangs? Just that the received count stops increasing? Does it always stop after the same count? It would be useful if you could also upload the script.

@IamPete1
Copy link
Member

IamPete1 commented Apr 9, 2024

I ran luacheck on your script, it finds a few issues:

    scripts/CAN test.lua:2:7: unused variable update_rate_ms
    scripts/CAN test.lua:10:7: unused variable get_xy
    scripts/CAN test.lua:11:1: setting read-only global variable type
    scripts/CAN test.lua:41:16: unused function pow2
    scripts/CAN test.lua:58:21: accessing undefined field ldexp of global math
    scripts/CAN test.lua:94:10: setting read-only global variable type

It would be useful to double check the script is still running. Can you enable disarmed logging and set SCR_DEBUG_OPTS bit 3 (value 8) for "log runtime memory usage and execution time".

@ketanatzebu
Copy link
Author

ketanatzebu commented Apr 10, 2024

Update: If I use CANFD at 1Mbps. I am getting continuous stream. The issue comes at 5Mbps.

@rmackay9
Copy link
Contributor

Hi @ketanatzebu,

I'm not too familiar with this area of the code but I guess you tried modifying the CAN_P1_FDBITRATE parameters and it didn't help?

@rmackay9
Copy link
Contributor

.. anyway, I guess this is resolved so I'm going to go ahead and close this issue if that's OK. I've ping'd other developers to get their input on whether we should support 5Mbps or not.

@ketanatzebu
Copy link
Author

Hi @ketanatzebu,

I'm not too familiar with this area of the code but I guess you tried modifying the CAN_P1_FDBITRATE parameters and it didn't help?

Yes, I configured my sensor for 1Mbps and changed the param CAN_P1_FDBITRATE to 1M.

@vasurk
Copy link

vasurk commented Jun 6, 2024

Hi @ketanatzebu ,

How did you configure the mmwave sensor and what lua scirpt you have added could you please inform?

Thanks

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

4 participants