hardware - No data on the "D1" and "D2" register of the MS5637 Altimeter/pressure sensor -


we having trouble reading d1 (0x40 ~ 0x4a) , d2 (0x50 ~ 0x5a) registers of measurement specialties ms5637. every time i2c call made these register return 0. odd since can read prom fine.

our setup followed: have custom pcb houses ble121lr (with embedded ti microcontroller) connected ms5637 , other sensors.

our procedure far is: 1. write reset @ 0x1e 2. read prom @ 0xa0 ~ 0xa5 3. read d1 & d2 @ 0x40 & 0x50 -> returns 0 @ osr.

i hope here can spot our error , getting , running ms5637.

i've attached our running code (bgscript), it's of assistance. before each command i've commented it's functionality:

#======================================================================================= # ms5637 barowither # address:    1110110x (write : x=0, read : x=1) ec ed # reset:      0x1e # prom read:  0xa0 0xae # read adc:   0x00 #=======================================================================================  ## reset command #call hardware_i2c_write(address, stop, data_len, data_data)(written) call hardware_i2c_write($ec, 1, 1, "\x1e")(msresetwritten)  ## write prom a0 #call hardware_i2c_write(address, stop, data_len, data_data)(written) call hardware_i2c_write($ec, 1, 1, "\xa0")(mspromwritten) ## read prom a0 #call hardware_i2c_read(address, stop, length)(result, data_len, data_data) call hardware_i2c_read($ed, 1, 2)(i2c_result, data_len, prom(0:2))  ## write prom a1 #call hardware_i2c_write(address, stop, data_len, data_data)(written) call hardware_i2c_write($ec, 1, 1, "\xa1")(mspromwritten) ## read prom a1 #call hardware_i2c_read(address, stop, length)(result, data_len, data_data) call hardware_i2c_read($ed, 1, 2)(i2c_result, data_len, prom(2:2))  ## write prom a2 #call hardware_i2c_write(address, stop, data_len, data_data)(written) call hardware_i2c_write($ec, 1, 1, "\xa2")(mspromwritten) ## read prom a2 #call hardware_i2c_read(address, stop, length)(result, data_len, data_data) call hardware_i2c_read($ed, 1, 2)(i2c_result, data_len, prom(4:2))  ## write prom a3 #call hardware_i2c_write(address, stop, data_len, data_data)(written) call hardware_i2c_write($ec, 1, 1, "\xa3")(mspromwritten) ## read prom a3 #call hardware_i2c_read(address, stop, length)(result, data_len, data_data) call hardware_i2c_read($ed, 1, 2)(i2c_result, data_len, prom(6:2))  ## write prom a4 #call hardware_i2c_write(address, stop, data_len, data_data)(written) call hardware_i2c_write($ec, 1, 1, "\xa4")(mspromwritten) ## read prom a4 #call hardware_i2c_read(address, stop, length)(result, data_len, data_data) call hardware_i2c_read($ed, 1, 2)(i2c_result, data_len, prom(8:2))  ## write prom a5 #call hardware_i2c_write(address, stop, data_len, data_data)(written) call hardware_i2c_write($ec, 1, 1, "\xa5")(mspromwritten) ## read prom a5 #call hardware_i2c_read(address, stop, length)(result, data_len, data_data) call hardware_i2c_read($ed, 1, 2)(i2c_result, data_len, prom(10:2))  ## write prom values ble service prom_handle #  call attributes_write(handle, offset, value_len, value_data)(result) call attributes_write(prom_handle, 0, 12, prom(0:12))  #----------------------------- # d1 & d2 #----------------------------- ## read d1 osr=256 #call hardware_i2c_write(address, stop, data_len, data_data)(written) call hardware_i2c_write($ec, 1, 1, "\x40")(msd1d2written) ## read d1 #call hardware_i2c_read(address, stop, length)(result, data_len, data_data) call hardware_i2c_read($ed, 1, 3)(i2c_result, data_len, dvalues(0:3))  ## read d2 osr=256 #call hardware_i2c_write(address, stop, data_len, data_data)(written) call hardware_i2c_write($ec, 1, 1, "\x50")(msd1d2written) ## read d2 #call hardware_i2c_read(address, stop, length)(result, data_len, data_data) call hardware_i2c_read($ed, 1, 3)(i2c_result, data_len, dvalues(3:3))  ## write d1 & d2 values ble service d2_handle #  call attributes_write(handle, offset, value_len, value_data)(result) call attributes_write(d_handle, 0, 6, dvalues(0:6)) 

after experimentation i'm answering own question in hopes might others.

here steps read d1 & d2 values ms5637 on i2c:

  1. write d register (for d1 0x40 (hex))
  2. write adc register (0x00)
  3. read adc (the adc return d1 value)
  4. if working bluetooth in case: write value bluetooth service. in bg script done with: "call attributes_write"

Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -