jlaitine opened a new pull request, #20428:
URL: https://github.com/apache/nuttx/pull/20428

   ## Summary
   
   This PR adds two fixes for imxrt_lpspi, targeted for imxrt1180:
   - IMXRT118x crashes when trying to read the LPSPI register if the block 
doesn't have clocks. The very
     first initialization however already checks the IMXRT_LPSPI_CR. Instead of 
trying to read the register
     without knowing what state the block is in, just have an "initialized" 
flag in the priv structure.
   - There is a small change in the LPSPI IP used in imxrt118x compared to 
previous versions; the LPSPI_CCR
     register is no longer read/write. Instead, read always returns 0. This 
causes the modifyreg32 always zeroing
     out all the bits which it is not setting. Fix this for 118x only by using 
putreg8 to write the part of the register.
     This is the RM instructed method for setting it.
   
   ## Impact
   
   Impacts only imxrt. Functionality for other imxrt chips should not change. 
For imxrt118x fixes a crash when
   lpspi clock is not readily enabled when first calling the init fuction.
   
   ## Testing
   
   Tested on external application, using PX4 configuration for imxrt1189, with 
3 IMUs (2 x icm42688p@24MHz + icm42688p@7MHz), with SPI+DMA configured. Getting 
samples at 850 and 800 Hz. Accelerometer data dump:
   
   ```
   > listener sensor_accel
   
   TOPIC: sensor_accel 3 instances
   
   Instance 0:
    sensor_accel
       timestamp: 164080619 (0.000699 seconds ago)
       timestamp_sample: 164080382 (237 us before timestamp)
       device_id: 2490386 (Type: 0x26, SPI:2 (0x00))
       x: -0.52577
       y: -0.47573
       z: -9.74153
       temperature: 22.40338
       error_count: 0
       clip_counter: [0, 0, 0]
       samples: 10
   
   
   Instance 1:
    sensor_accel
       timestamp: 164098242 (0.000632 seconds ago)
       timestamp_sample: 164098043 (199 us before timestamp)
       device_id: 2490642 (Type: 0x26, SPI:2 (0x01))
       x: -0.40797
       y: -0.23200
       z: -9.99460
       temperature: 25.16304
       error_count: 0
       clip_counter: [0, 0, 0]
       samples: 10
   
   
   Instance 2:
    sensor_accel
       timestamp: 164110440 (0.000324 seconds ago)
       timestamp_sample: 164110115 (325 us before timestamp)
       device_id: 2424850 (Type: 0x25, SPI:2 (0x00))
       x: -0.33200
       y: -0.49799
       z: -9.40682
       temperature: 29.09896
       error_count: 0
       clip_counter: [0, 0, 0]
       samples: 6
   ```
   
   
   
   


-- 
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