nttedt-furuya opened a new pull request, #19605:
URL: https://github.com/apache/nuttx/pull/19605

   ## Summary
   
   There is stack-uninitialized union in `imxrt_transmit()`.
   Every frame transmitted has random IDE/SRR/ESI/BRS bits.
   BRS is usually zero meaning CAN FD speedup in data phase does not happen.
   Fix:
   
   - Zero initialize the union
   - Allow setting BRS bit from `frame->flags`
   
   ## Impact
   
   - imxrt flexcan transmit path
   
   ## Testing
   
   px4 on custom board sending data over CAN FD to Linux PC using Kvaser USBcan 
Pro 2xHS v2
   
   Setup:
   - nominal 500 kbit/s / data 1 Mbit/s
   - two CAN FD frames sent
     - ID 0x10 (12 bytes), payload all 0x00
     - ID 0x20 (32 bytes), payload all 0x00
   - Probe on CAN_L to GND, 50 µs/div.
   - Each capture shows the full 0x10 frame followed by the start of 0x20 
(truncated at the right edge of the record).
   
   <img width="1025" height="1264" alt="image" 
src="https://github.com/user-attachments/assets/f3e53d12-6911-4ec1-94be-0153f46a17a2";
 />
   
   - **Before fix:** the entire frame is transmitted at one bit rate —
     uniform ~2 µs bit widths from SOF through ACK. The 0x10 frame takes ~336 
µs,
     which is exactly 168 bits (147 frame bits + 21 stuff bits for the all-zero
     payload) at 500 kbit/s. No bit-rate switch occurs, i.e. BRS is going out
     dominant (0).
   
   - **After fix:** the frame starts identically (same ID pattern,
     same ~2 µs bits through the arbitration/control field), then the bit width
     halves exactly at the BRS bit position (SOF + 18 bits). The data phase 
runs at
     1 Mbit/s and returns to nominal at the CRC delimiter for ACK/EOF. The same
     frame now completes in ~188 µs, matching the bit-exact prediction for BRS 
= 1
     at this timing configuration.
   
   The two captures are identical up to the BRS bit and the portion after it 
runs
   exactly 2.0× faster, matching the configured 500k:1M ratio — so the only 
change
   on the wire is BRS: dominant before the fix, recessive after. Frames are 
ACKed
   normally in both captures (inter-frame gap = 11 bit times, no error frames).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to