Example_S32K144_I2C_Master_MPL3115A2_S32DSR1_v3

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Example_S32K144_I2C_Master_MPL3115A2_S32DSR1_v3

Example_S32K144_I2C_Master_MPL3115A2_S32DSR1_v3

****************************************************************************************
Detailed Description:
This is a rather simple example that shows LPI2C0 in Master mode.
MPL3115A2 sensor is used as a slave device.
I2C bus at PTA2 SDA, PTA3 SCL (2-pin open drain mode),
external pull-up resistors on BRKTSTBC-P3115 board.
BRKTSTBC-P3115 supplied from P3V3 (J3.7).
Baud rate 400kHz, source SIRCDIV2 8MHz.
The master reads periodically MPL3115A2 status register (every 200ms)
and temperature / altitude data once they are ready.
-------------------------------------------------------------------------------------------------------
Test HW: S32K144EVB-Q100, BRKTSTBC-P3115
MCU: S32K144 0N57U
IDE: S32DSR1, OpenSDA
Target: internal_FLASH
****************************************************************************************

Tags (2)
Attachments
Comments

Hello, 

I am using this code for i2c protocol between s32k144(master) and lidar lite v3(slave). I have configured the addresses and registers properly. I am receiving distance values , however I have to reboot the sensor to get new values. I tested the sensor with other boards , it works fine. This sensor does not support repeated start hence I have edited the read and write accordingly. 

pastedImage_1.png

I am attaching my modified code below. Could you tell me what could be my mistake?

Any help appreciated!!

LidarV3.7z - Box 

Thank you,

Arjun.

Hello Arjun,

Can you please scope the bus and compare it with the specified lidar lite v3 I2C protocol?

Do you see any error flags?

pastedImage_1.png

Thanks,

BR, Daniel

%3CLINGO-SUB%20id%3D%22lingo-sub-1125255%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EExample_S32K144_I2C_Master_MPL3115A2_S32DSR1_v3%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1125255%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E****************************************************************************************%3CBR%20%2F%3EDetailed%20Description%3A%3CBR%20%2F%3EThis%20is%20a%20rather%20simple%20example%20that%20shows%20LPI2C0%20in%20Master%20mode.%3CBR%20%2F%3EMPL3115A2%20sensor%20is%20used%20as%20a%20slave%20device.%3CBR%20%2F%3EI2C%20bus%20at%20PTA2%20SDA%2C%20PTA3%20SCL%20(2-pin%20open%20drain%20mode)%2C%3CBR%20%2F%3Eexternal%20pull-up%20resistors%20on%20BRKTSTBC-P3115%20board.%3CBR%20%2F%3EBRKTSTBC-P3115%20supplied%20from%20P3V3%20(J3.7).%3CBR%20%2F%3EBaud%20rate%20400kHz%2C%20source%20SIRCDIV2%208MHz.%3CBR%20%2F%3EThe%20master%20reads%20periodically%20MPL3115A2%20status%20register%20(every%20200ms)%3CBR%20%2F%3Eand%20temperature%20%2F%20altitude%20data%20once%20they%20are%20ready.%3CBR%20%2F%3E-------------------------------------------------------------------------------------------------------%3CBR%20%2F%3ETest%20HW%3A%20S32K144EVB-Q100%2C%20BRKTSTBC-P3115%3CBR%20%2F%3EMCU%3A%20S32K144%200N57U%3CBR%20%2F%3EIDE%3A%20S32DSR1%2C%20OpenSDA%3CBR%20%2F%3ETarget%3A%20internal_FLASH%3CBR%20%2F%3E%20****************************************************************************************%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1125257%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Example_S32K144_I2C_Master_MPL3115A2_S32DSR1_v3%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1125257%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%20Arjun%2C%3C%2FP%3E%3CP%3ECan%20you%20please%20scope%20the%20bus%20and%20compare%20it%20with%20the%20specified%20lidar%20lite%20v3%20I2C%20protocol%3F%3C%2FP%3E%3CP%3EDo%20you%20see%20any%20error%20flags%3F%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22pastedImage_1.png%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22pastedImage_1.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F77039iBFDCCFF25E48D6B6%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22pastedImage_1.png%22%20alt%3D%22pastedImage_1.png%22%20%2F%3E%3Cspan%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EpastedImage_1.png%3C%2Fspan%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EThanks%2C%3C%2FP%3E%3CP%3EBR%2C%20Daniel%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1125256%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Example_S32K144_I2C_Master_MPL3115A2_S32DSR1_v3%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1125256%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%2C%26nbsp%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EI%20am%20using%20this%20code%20for%20i2c%20protocol%20between%20s32k144(master)%20and%20lidar%20lite%20v3(slave).%20I%20have%20configured%20the%20addresses%20and%20registers%20properly.%20I%20am%20receiving%20distance%20values%20%2C%20however%20I%20have%20to%20reboot%20the%20sensor%20to%20get%20new%20values.%20I%20tested%20the%20sensor%20with%20other%20boards%20%2C%20it%20works%20fine.%20This%20sensor%20does%20not%20support%20repeated%20start%20hence%20I%20have%20edited%20the%20read%20and%20write%20accordingly.%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22pastedImage_1.png%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22pastedImage_1.png%22%20style%3D%22width%3A%20753px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F100716i95395D163797560D%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22pastedImage_1.png%22%20alt%3D%22pastedImage_1.png%22%20%2F%3E%3Cspan%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EpastedImage_1.png%3C%2Fspan%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EI%20am%20attaching%20my%20modified%20code%20below.%20Could%20you%20tell%20me%20what%20could%20be%20my%20mistake%3F%3C%2FP%3E%3CP%3EAny%20help%20appreciated!!%3C%2FP%3E%3CP%3E%3CA%20class%3D%22link-titled%22%20href%3D%22https%3A%2F%2Fiu.box.com%2Fs%2Fimlhdjbjqi8ywchicor4rj9sjdvia5ux%22%20title%3D%22https%3A%2F%2Fiu.box.com%2Fs%2Fimlhdjbjqi8ywchicor4rj9sjdvia5ux%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3ELidarV3.7z%20-%20Box%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EThank%20you%2C%3C%2FP%3E%3CP%3EArjun.%3C%2FP%3E%3C%2FLINGO-BODY%3E
No ratings
Version history
Last update:
‎11-25-2018 01:09 PM
Updated by: