melexis / mlx90640-library

MLX90640 library functions
Apache License 2.0
241 stars 192 forks source link

mlx90641 drivers work, mlx90640 drivers don't... bad temperature conversion? #89

Open luigi-grim opened 3 years ago

luigi-grim commented 3 years ago

Hello. I'm trying to implement the mlx90640 on a CC2538 texas instrument and a Contiki os. I successfully implemented the mlx90641 getting an output like this:

DumpEE:
b0  899f    0   2031    5   320 3e0 161b    f6e3    6186    ad9 0   901 0   0   be33    
0   7f6 e   0   0   28b 222 281 164 1ad 1ad 1ad 4dd 525 542 554 
534 4da 7da 200 f0  1d  677 79a 164 4   12c 8   540 321 23  7ee 
1c  313 197 420 16  4b9 4b9 4b9 4b9 4b9 190 4b9 1f4 4b9 258 4b9 
7f9 7fd 4   14  b   9   e   d   3   1   7fc 0   7e1 7e8 7dc 7d6 
28  15  20  1a  1e  1f  28  1a  1e  1a  1e  e   9   7fe 7fc 7e9 
7fe 8   12  16  13  d   e   1e  b   d   8   13  7f7 7f7 7ef 7e3 
26  1b  21  21  20  27  2b  23  23  1f  27  19  15  c   8   7f9 
0   8   e   18  14  12  17  1f  d   16  c   15  7fc 7ff 7f5 7f4 
1d  10  1d  16  1d  21  26  1f  20  21  23  15  17  10  10  1   
7eb 7ff 7f9 c   5   5   9   14  a   6   8   15  7fd 0   7f9 2   
5   7fd 9   2   8   c   19  d   12  14  1c  13  14  f   10  2   
7d0 7db 7e1 7f7 7f1 7f0 7f2 4   7f6 7f8 7f9 d   7f5 7f6 7f6 4   
7e2 7db 7e7 7e6 7ec 7f1 7fa 7f5 7ff 2   10  1   4   1   6   6   
7a1 7b4 7bc 7ca 7c8 7c8 7d3 7db 7d5 7dc 7dc 7f4 7e8 7e9 7e8 7f8 
791 790 79d 797 7a3 7ac 7bc 7b1 7bf 7cb 7df 7d9 7e4 7e9 7f5 7ef 
581 619 67c 6d0 74f 78d 78b 7b7 7ae 7b3 76e 747 72c 6b6 641 5c0 
5cd 670 6db 74a 7a7 7e1 7dc 7f9 7f4 7fc 7af 78c 774 728 695 600 
5bf 659 6bb 740 7a6 7cd 7dc 7c4 7eb 7c2 7a5 762 74e 708 685 60d 
5e3 67e 6f7 743 7aa 7cc 7d9 7ed 7fc 7ff 7b5 784 765 730 6a9 617 
5d5 668 6e5 756 7b8 7ca 7d7 7d6 7ff 7c5 7c6 786 776 720 6af 61d 
5ee 685 6df 765 7a7 7db 7e0 7f4 7fe 7fd 7bd 794 768 732 69b 624 
5d0 649 6ea 73f 7af 7d8 7ed 7da 7ee 7ff 7ae 778 765 713 68c 609 
5ba 644 6aa 724 794 7d0 7b9 7e0 7de 7da 799 76c 72f 6df 660 5f1 
5aa 64e 6be 711 794 7d5 7ed 7e5 7ff 7f7 7c0 769 760 6ea 667 5dc 
568 5f9 668 6d6 732 786 7a5 7bb 7a9 7b2 755 73f 6ef 6a5 614 584 
58b 610 67f 6ef 76a 7ad 7c5 7f5 7fc 7e4 7bf 757 730 6af 633 5b5 
524 5b8 60a 69a 6dc 741 73c 782 77d 76d 715 704 6b1 65e 5bc 53c 
7a0 6e0 6bf 700 700 720 71f 6df 77e 71f 6df 79f 6fd 740 1f  61  
7a7 6e3 6c3 721 760 6e2 722 71f 77f 721 6e1 6ff 780 6e1 7a1 2   
7c0 7c1 7a1 7c0 7e0 73f 75e 7df 7be 77e 77d bf  79d 3f  7df 61  
67  784 784 7a1 7a1 762 722 77f 77f 701 761 73e 79f 7a1 7a1 41  
21  7c2 7a0 0   1f  7ff 7de 1e  7fd 1e  79d 3e  77c 3e  1e  a1  
89  7a5 7e4 741 1   7c2 7e2 77f 7df 781 0   77e 7df 760 761 7e1 
83  c3  41  81  20  9f  3e  3e  7c  7e  79d 7e  7bc 3e  7be a0  
12a 45  64  41  62  1   61  7be 7de 7a0 7ff 7be 1e  760 7a0 760 
105 144 e2  121 e0  9f  5e  fe  bc  5d  7fc fd  3c  7fd 7de 7f  
1cc 87  65  c2  101 81  a0  5d  fd  7df 5f  7fd 7fe 79f 75f 7df 
128 185 162 161 140 15e 13d fc  7b  9c  3c  7d  5c  79d 77d 7e0 
16c 147 143 e0  13e 11f 11d 9b  7c  7c  5d  7fc 75d 6ff 6ff 71f 
7f9 7fb 4   15  b   7   d   d   4   7ff 7fc 0   7e2 7e7 7db 7d6 
28  13  20  1a  1f  1e  28  1b  1f  18  1e  e   8   7fd 7fc 7e9 
7ff 7   12  16  14  c   e   1e  c   b   7   13  7f7 7f5 7ee 7e3 
27  1a  21  21  21  26  2b  23  24  1e  26  19  16  b   7   7f9 
1   7   e   18  15  12  16  20  e   15  d   16  7fd 7fe 7f5 7f4 
1e  f   1d  16  1e  20  26  1f  21  1f  24  16  18  f   f   1   
7ec 7fd 7f8 d   6   4   9   14  a   6   8   14  7fd 7fe 7f8 1   
6   7fc 9   3   8   b   19  c   12  13  1b  13  14  e   f   2   
7d1 7da 7e0 7f7 7f2 7ee 7f1 4   7f7 7f8 7f8 e   7f5 7f5 7f6 4   
7e4 7da 7e7 7e6 7ec 7f1 7fb 7f5 0   0   f   2   5   0   6   7   
7a2 7b3 7bc 7ca 7c9 7c7 7d2 7dc 7d6 7dc 7dd 7f5 7e9 7e8 7e8 7f9 
792 78f 79e 798 7a4 7ab 7bc 7b2 7c0 7cb 7e0 7db 7e6 7e8 7f6 7f0 
status Frame-synch:0
Get frame!
Status get_frame:0
Frame:
fe93    fe8f    fe92    fe9d    fe92    fe89    fe8d    fe8c    fe83    fe87    fe84    fe83    fe68    fe74    fe72    fe7b    
febe    fea6    feac    fea2    fea1    fe9f    feaa    fe98    fe9c    fe9f    fea5    fe90    fe8e    fe86    fe94    fe8f    
fe95    fe95    fe99    fe99    fe91    fe89    fe88    fe9a    fe82    fe92    fe8d    fe92    fe79    fe82    fe87    fe8c    
feed    fee1    fee3    fede    fed9    feda    fed7    fec5    febc    feb8    febd    fea2    fea0    fea1    fea7    fea0    
feec    fefa    ff05    ff11    ff0d    ff06    ff0f    ff14    fef7    fefd    fefb    fef7    fec8    feb9    feb0    feb1    
ff0d    ff06    ff1c    ff16    ff22    ff28    ff2d    ff27    ff03    ff0a    ff26    feff    feee    fee3    feea    fee7    
fec1    fede    fee2    fef8    feed    feeb    fefc    ff0b    fedb    fee7    fef3    fee7    fec0    fec2    fec9    fedc    
feb5    feaf    febe    feb2    feb3    febe    fed4    fec6    feba    feca    fed4    fec6    fec4    fec6    fecd    fec0    
fe83    fe8b    fe90    fea9    fea1    fea6    fea2    feb1    fe9c    fead    fea6    fecf    fec5    fecc    feb8    febb    
fe94    fe9f    fe9f    feb9    feb8    fef3    fec5    fecc    ff01    ff09    feea    ff4e    ff3b    fefa    feba    feb4    
fe54    fe69    fe74    fe76    fe7c    fe78    fe83    feae    fea7    fe8e    fec1    feae    fe8c    fe8f    fe92    fea4    
fe3d    fe3c    fe49    fe3c    fe4a    fe4e    fe64    fe59    fe64    fe71    fe88    fe7b    fe83    fe8b    fe9e    fe9c    
4e8c    7fff    7fff    7fff    7fff    7fff    7fff    7fff    fdda    f4fe    1e42    d7be    2   3   4   3   
1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   
665 1997    1997    1997    1997    1997    1997    1997    fdd5    cc69    ce7f    d6f9    2   ffff    a   5   
901 0   
Vdd: 3.29718
Ta: 22.912817
Temperature:
22. 22. 22. 22. 22. 22. 21. 22. 22. 22. 22. 22. 22. 22. 22. 24. 
22. 22. 22. 22. 22. 22. 22. 22. 22. 22. 22. 22. 22. 22. 23. 24. 
22. 22. 22. 22. 22. 22. 22. 22. 22. 22. 22. 22. 22. 22. 23. 24. 
27. 27. 27. 26. 26. 26. 25. 25. 24. 24. 24. 23. 23. 23. 24. 24. 
31. 31. 31. 31. 31. 30. 31. 30. 30. 29. 30. 29. 28. 26. 26. 26. 
31. 31. 32. 31. 32. 32. 32. 32. 29. 30. 31. 30. 28. 28. 29. 30. 
29. 29. 30. 30. 30. 29. 30. 30. 28. 29. 30. 28. 27. 27. 28. 29. 
25. 25. 26. 26. 25. 26. 26. 26. 25. 26. 26. 26. 26. 26. 26. 26. 
25. 25. 25. 26. 26. 26. 26. 26. 25. 26. 25. 27. 28. 28. 27. 26. 
25. 27. 26. 28. 28. 32. 28. 28. 31. 32. 29. 37. 36. 31. 25. 25. 
25. 26. 26. 25. 26. 26. 26. 28. 28. 26. 30. 26. 24. 24. 24. 24. 
24. 25. 25. 24. 25. 24. 25. 25. 25. 25. 25. 24. 24. 24. 24. 24. 
========================

But when i switched on the mlx90640 (of course with new main libraries, while i2c library is almost the same) i'm getting some strange results:

DumpEE:
c5  699f    0   2061    5   320 3e0 61a f6f3    189 499 0   1901    0   0   be33    
4320    ffba    202 102 101 f1f1    e0f1    cfe0    f00 1   1   f001    f002    f1f2    e0f2    c0e1    
88a5    39e0    dca9    10fe    3322    3333    1122    ddff    fffe    0   1111    1121    1111    11  ff00    cdee    
1845    2fab    1956    a173    7656    f9cb    5c5c    5a5a    2463    f88d    17b3    63c f600    9797    9797    2afa    
fcee    ff50    182e    ec9e    ff70    1e  10ce    f07e    fbfe    f80e    cc0 e49e    f53e    f700    111e    ecee    
f8be    e91e    c6e e7ee    ec00    ec20    f8fe    dfee    f3c0    e750    7b0 e2de    e0a0    e3f0    3e0 d910    
18f2    175e    102c    1c90    1b70    140e    8ac 2050    1bf0    13fe    8bc 1860    1530    efe d0c 20d0    
1ca2    4fe 87c 23e0    1012    82e fcec    1bd0    17e0    36e bbc 1ee0    8c0 e   7ce 1500    
2e  fb4e    146e    e86e    f7fe    fffe    8d0 e52e    fbde    f02e    89e e04e    f8fe    f320    cf0 e8ce    
ed30    e58e    c4e e7fe    efe0    ec10    f900    d87e    e810    e730    7e2 df4e    e86e    e3e0    3b0 d950    
2412    131e    103c    2040    13f0    13ee    4ce 1910    1ba0    fec 46c 1420    1cc0    afe 8cc 2090    
1110    13e c3c 1fd0    13d2    ffe f8ce    1430    13d2    6fe bce 1b20    1020    3ce 7ae 1130    
840 fb70    1060    e8ae    ffc0    f8b0    8b0 e8ee    ffc0    fbc0    fbe e05e    f9ae    f330    cbe e96e    
f510    ec70    890 e48e    ec30    f400    f952    dcbe    ec50    e7b0    40  dbe0    e4de    e080    fc02    d980    
2432    b4e 86e 1470    1b90    88e 7c  1890    1ba0    f8e bbc 1030    1550    ade 4bc 1940    
1500    83e 88e 1860    13e2    13b0    f92e    1080    1002    37e 42e 13c0    4d2 f870    7ce 1130    
14d0    17d0    3060    48e 17b0    1840    28a0    4de 17be    17f0    2840    fc6e    d7e 16c0    2cb0    c7e 
940 920 2480    43e 450 17c0    1510    f86e    c10 7f0 2090    ffc0    4b0 420 27f2    f9c0    
c82 39e 42e 1040    b72 40e fc6e    1080    f72 79e fc1c    c20 940 690 ae  1850    
4e0 fcce    4e  17f0    42  ba0 f0ee    c22 13e4    ffc0    fc7e    1382    882 3d0 37e 970 
cb0 1740    2c20    44e bae 1bc0    20c0    be  1370    1780    27d0    fc5e    d00 ef0 2470    49e 
c70 4e0 2040    fc00    7a0 1390    10e0    f83e    bd0 3d2 1c20    ff4e    460 7e2 1fa2    f550    
f2  fb7e    f87e    860 ffc2    3de ed0e    8f0 7d2 ffde    fbfe    470 530 fefe    f89e    10a0    
4b0 f520    f4be    c30 3e2 3be e90e    852 802 f7f0    f46e    f92 492 fff0    ffb0    980 
1490    1722    2be0    4e  1ad0    1b92    1c40    6e  bfe 1352    1fd0    fffe    1470    ed0 1c70    48e 
c70 480 1ff0    ffbe    7e0 fe0 ca2 f0a0    3f0 3a0 c50 f3d0    fc20    10  1780    f520    
c2  f72e    f01e    fc72    702 fbb0    e86e    470 f810    fb50    ec1e    fc10    892 f6e0    f0ae    892 
92  f0be    f04e    bd2 fc12    f800    e0ee    fcb0    fc34    efde    ec70    fff0    fc52    f010    f3a0    140 
100 1352    1c00    f880    f40e    13b2    1430    fc20    390 802 1be0    f090    e0  b22 18b0    fcb0    
c0  d2  1810    f840    ffb0    bf0 490 f030    ffe2    ffd2    1022    f3d0    f892    fc40    13b2    f4f0    
8f2 730 42e 10a2    10  13b0    fc6e    1840    13a2    82e e   10b2    14f2    b20 4be 20b0    
14c2    8ce 44e 1882    13d2    100e    f8be    1840    1bf2    bd0 830 1fd0    10b2    85e bc0 20e2    
f0d0    f62 1050    f41e    fb50    f92 8c0 f450    f010    7b2 c12 f3e0    fcc0    ff72    1082    f4e0    
f8c0    fca2    13c0    f010    f3d0    772 fca2    ec10    f7a2    f7f0    812 eba0    f020    f422    b92 f0c0    
f8c2    fb40    f07e    832 372 3a0 e8ee    c62 fc22    3c0 f01e    ff2 8a2 fb7e    f4be    1112    
4e2 fc90    ffc0    1432    7e2 f8e ecbe    1012    fb4 fff0    fc0e    17a0    c22 2e  fbc0    14d2    
f4b2    752 862 f070    e800    fcb0    fc70    e8c0    f7b0    f832    fff0    e4c0    f500    fb20    90  ecf0    
f4c0    f4e2    472 e860    e812    3b2 f8d0    e100    e870    f3e0    f820    eb80    e0ae    f792    ff62    ecb0    
f0b4    ef60    dc9e    fca2    ec02    ecc0    dc8e    fcc2    ffb2    f020    e7fe    f4c0    fcf2    f310    e8de    510 
e2  f0d0    ec9e    872 f422    ffc0    e0fe    112 f8a2    ec20    ec20    b60 f882    ff80    f760    cc2 
f0f0    1ba2    1832    b0  fbb0    1822    d02 c0  390 17b2    1bb2    fc10    d0  f42 18b2    120 
fd20    d12 1c42    420 f820    17a0    8b2 fc80    3d2 bc2 1bb2    340 fff0    1382    1752    470 
ecd2    fb70    f01e    892 fba2    410 e8de    ca2 392 b90 fbb0    13e2    4e2 330 f8be    1912    
502 e0  e   1c02    42  13d0    f0d0    14a2    fd2 7f0 7a0 2312    17e2    1370    360 2872    
dcd0    f44 482 f880    e080    c92 f972    f510    f3c0    462 fe0 f7f0    f500    ad2 8d0 fcc0    
e950    4a2 c82 ffc0    e870    842 f910    f070    f3b0    732 bb0 f740    f010    7b0 772 fca0    
d4a2    eb10    d460    f862    d872    ec60    cd6e    fcf2    ebf2    e880    e7ce    3f2 f4f2    f6e0    e4de    cb2 
ed62    f490    e89e    13d0    e8b2    f890    dcee    840 ff84    2f0 f380    1312    7f2 380 f340    1890    
f100    2724    1432    8b0 f800    27f2    1080    ca0 fc50    1c22    c50 b0  910 1f12    18b0    14e0    
510 18f2    2072    c60 fc90    2020    1470    810 ffc0    1b02    1b20    780 f430    1f52    16e0    1850    
e0e2    faf2    dc10    a2  ebc2    3c0 dc60    c82 f442    fc00    e070    f8e0    502 310 f490    14e0    
4f2 4d0 fc50    1c42    62  13e0    f050    1802    b72 ec0 6e0 1730    802 1720    aa0 2820    
Extract params done, status=:0 
Get frame!
Status get_frame:1
Frame:
ffd7 ffd7 ffdc ffd5 ffdd ffda ffde ffd5 ffdb ffd5 ffd8 ffc9 ffbf ffb8 ffbc ffb1 ffc0 ffb2 ffbd ffb1 ffbd ffb2 ffbf ffb0 ffc2 ffb3 ffc0 ffb0 ffbd ffb1 ffc2 ffac 
ffce ffcb ffcc ffd0 ffd3 ffce ffcc ffd2 ffd4 ffcc ffc3 ffc4 ffb2 ffac ffab ffad ffb7 ffa9 ffac ffad ffb6 ffa7 ffad ffae ffb9 ffa8 ffb1 ffad ffb7 ffa9 ffb5 ffaa 
ffd9 ffd7 ffdc ffd5 ffd9 ffd7 ffde ffd3 ffdb ffd4 ffd0 ffbe ffbb ffb3 ffba ffaf ffbc ffb0 ffba ffaf ffbd ffb1 ffbd ffad ffc0 ffb2 ffbf ffac ffbe ffaf ffc2 ffa9 
ffd0 ffcd ffca ffd2 ffd3 ffcf ffce ffd2 ffd3 ffcb ffb9 ffb3 ffb2 ffa9 ffab ffac ffb4 ffa8 ffa9 ffac ffb5 ffa7 ffac ffad ffb8 ffa8 ffaf ffab ffb8 ffa8 ffb3 ffa5 
ffdb ffd7 ffd9 ffd2 ffde ffd7 ffdc ffd5 ffda ffd4 ffc0 ffb2 ffb9 ffb3 ffba ffae ffbd ffb3 ffb9 ffac ffbd ffb1 ffb9 ffad ffbe ffb1 ffbb ffac ffba ffae ffc2 ffa9 
ffd1 ffcb ffc9 ffcf ffd3 ffcd ffcc ffd1 ffd0 ffc3 ffad ffab ffaf ffa7 ffa6 ffa9 ffb3 ffa9 ffa9 ffab ffb6 ffa7 ffaa ffa7 ffb6 ffa7 ffac ffa8 ffb4 ffa6 ffb2 ffa6 
ffd7 ffd7 ffd9 ffd5 ffda ffd8 ffda ffd2 ffd3 ffc4 ffb9 ffae ffb8 ffb3 ffb9 ffaf ffb6 ffaf ffb9 ffae ffb9 ffb0 ffb9 ffac ffbd ffaf ffbb ffad ffbc ffb0 ffc1 ffa7 
ffcc ffc9 ffc7 ffcd ffcf ffc9 ffca ffcd ffc4 ffb2 ffa4 ffa8 ffad ffa7 ffa6 ffa8 ffae ffa5 ffa7 ffa8 ffb1 ffa5 ffa7 ffa8 ffb4 ffa4 ffaa ffa9 ffb4 ffa4 ffb3 ffa3 
ffd4 ffd6 ffd8 ffd4 ffda ffd9 ffd9 ffcf ffc1 ffb5 ffb5 ffad ffb5 ffb0 ffb8 ffac ffba ffae ffb5 ffaa ffb8 ffae ffb5 ffab ffbb ffaf ffb8 ffac ffba ffaf ffbe ffa5 
ffca ffc7 ffc4 ffcc ffcd ffca ffc4 ffc7 ffb1 ffa5 ffa4 ffa8 ffab ffa3 ffa4 ffa5 ffae ffa1 ffa2 ffa6 ffaf ffa3 ffa4 ffa6 ffb3 ffa1 ffa9 ffa7 ffb2 ffa4 ffaf ffa3 
ffd4 ffd5 ffd6 ffd3 ffd9 ffd6 ffd2 ffc5 ffb5 ffb1 ffb2 ffad ffb5 ffaf ffb3 ffa9 ffb7 ffac ffb7 ffaa ffb7 ffad ffb6 ffaa ffba ffac ffb6 ffaa ffb8 ffab ffbb ffa6 
ffc8 ffc5 ffc0 ffc8 ffce ffc4 ffba ffb7 ffa7 ffa5 ffa0 ffa5 ffac ffa3 ff9f ffa3 ffae ffa1 ffa2 ffa6 ffad ff9f ffa3 ffa3 ffb0 ff9d ffa5 ffa1 ffaf ffa1 ffab ffa0 
ffd0 ffd4 ffd3 ffd0 ffd1 ffd1 ffc6 ffb7 ffb2 ffb0 ffb1 ffab ffb1 ffae ffb3 ffa8 ffb5 ffad ffb2 ffa8 ffb4 ffab ffb6 ffaa ffb9 ffab ffb8 ffa6 ffb6 ffaa ffbb ffa5 
ffc0 ffc1 ffbd ffc5 ffc1 ffc1 ffab ffa9 ffa5 ff9f ff9e ffa1 ffa6 ff9e ff9e ffa1 ffab ff9d ffa0 ffa0 ffaa ff9e ffa3 ffa4 ffaf ff9e ffa5 ffa3 ffad ff9e ffab ffa1 
ffcb ffd1 ffd1 ffcd ffcc ffcc ffb5 ffad ffad ffae ffb0 ffaa ffaf ffac ffb0 ffa7 ffb3 ffac ffb1 ffa6 ffb1 ffac ffb3 ffa7 ffb7 ffaa ffb7 ffa5 ffb5 ffa9 ffba ffa6 
ffbb ffbc ffb8 ffc3 ffbc ffb5 ff9b ffa2 ffa0 ff9d ff9a ffa2 ffa3 ff99 ff9a ffa0 ffa8 ff9c ff9e ff9f ffa8 ffa0 ffa1 ffa1 ffac ff9a ffa2 ffa1 ffab ff9d ffa8 ff9e 
ffcb ffce ffcc ffca ffc2 ffbd ffaf ffa9 ffb0 ffad ffaf ffa7 ffae ffac ffae ffa5 ffb4 ffab ffae ffa6 ffb3 ffab ffb2 ffa5 ffb3 ffaa ffb2 ffa7 ffb4 ffab ffb8 ffa5 
ffba ffb9 ffb1 ffbb ffb2 ffa3 ff98 ff9d ffa2 ff9b ff98 ff9d ff9f ff97 ff97 ff99 ffa6 ff9a ff9a ff9b ffa4 ff9a ff9c ff9c ffa7 ff99 ff9f ff9e ffa6 ff9e ffa6 ff9c 
ffc3 ffcc ffc8 ffc3 ffb6 ffb2 ffac ffa8 ffaa ffab ffae ffa7 ffa9 ffa8 ffad ffa3 ffaf ffa8 ffad ffa4 ffae ffaa ffaf ffa5 ffb2 ffa6 ffb6 ffa5 ffb1 ffaa ffb5 ffa5 
ffb2 ffb2 ffab ffb2 ffa2 ff9c ff91 ff9e ff9a ff97 ff94 ff9c ff9a ff95 ff95 ff99 ffa0 ff96 ff96 ff9b ffa0 ff99 ff9a ff9a ffa5 ff98 ff9e ff9c ffa8 ff9a ffa3 ff9c 
ffbb ffc8 ffbe ffbb ffa7 ffac ffa6 ffa6 ffa8 ffa9 ffaa ffa7 ffaa ffa9 ffaa ffa3 ffa9 ffa6 ffac ffa4 ffab ffa5 ffae ffa3 ffaf ffaa ffb2 ffa4 ffb1 ffa9 ffb5 ffa3 
ffa9 ffaf ffa1 ffaa ff92 ff93 ff8c ff96 ff95 ff90 ff92 ff96 ff98 ff94 ff90 ff98 ff98 ff94 ff93 ff9a ff9b ff92 ff95 ff9c ffa3 ff99 ff9c ff9c ffa3 ff9a ff9e ff9b 
ffb8 ffc4 ffb6 ffb1 ffa4 ffa9 ffa4 ffa2 ffa3 ffa6 ffa3 ffa1 ffa6 ffa7 ffa8 ffa1 ffab ffa5 ffa9 ffa2 ffaa ffa7 ffad ffa3 ffad ffa6 ffb1 ffa2 ffad ffa9 ffb2 ffa6 
ff9c ffa0 ff8c ff94 ff88 ff89 ff7f ff8b ff87 ff87 ff7f ff85 ff8d ff85 ff85 ff8a ff90 ff88 ff88 ff8e ff92 ff8a ff8b ff8e ff98 ff8d ff90 ff8d ff96 ff8f ff98 ff91 
4f51 197f 7fff 197f 7fff 197e 7fff 197e ffb8 cbbb 189d d666 fff7 8 ffff fffe 1948 3f7 25d 7fff 1948 3f7 25d 7fff 1 1 1 1 1 1 1 1 
65f 7fff 197f 7fff 197f 7fff 197e 7fff ffbe f4fc ce51 d70b 7 fffb fffb 0 f3 3f 2865 3d f3 3f 2865 3d 1 1 1 1 1 1 1 1 
1901 1 
Vdd: 3.04934
Ta: 20.430614
Temperature:
229 235 217 226 219 210 201 216 201 206 205 212 197 212 191 213 188 207 195 221 206 227 203 233 214 244 230 254 247 272 254 310 
266 241 237 242 235 228 222 232 224 222 213 227 220 218 209 228 219 221 213 231 228 230 218 244 226 245 234 265 255 270 272 309 
224 219 211 222 205 206 209 212 196 203 193 209 190 208 197 210 196 202 190 215 201 221 206 226 210 237 231 246 225 263 246 297 
256 237 229 235 230 224 229 227 219 207 210 223 212 214 207 223 209 216 207 227 223 223 225 238 231 239 239 257 247 263 263 298 
224 225 219 217 207 211 206 208 200 207 189 205 185 204 186 204 190 209 197 209 197 214 211 219 203 230 218 251 220 254 251 289 
251 235 239 235 28 28 29 28 225 88 23 125 111 217 0 36 0 0 127 22 0 155 22 134 52 2 140 23 23 23 23 24 
0 0 122 29 0 141 28 125 0 6 108 22 23 22 22 22 200 77 22 123 22 22 22 22 14 37 22 23 23 23 -33 15 
16 45 28 28 28 28 28 28 26 24 22 22 22 22 22 22 22 22 22 22 22 22 130 195 -17 16 16 16 23 22 24 23 
28 28 -99 185 29 28 28 28 24 22 -16 17 22 22 22 22 103 22 22 22 0 108 113 22 22 33 22 206 23 23 23 23 
28 28 28 0 28 28 28 27 255 116 129 24 22 22 22 22 22 22 251 187 22 22 22 22 22 22 0 207 23 23 23 23 
28 28 28 28 28 28 27 26 22 22 22 22 22 22 22 22 22 22 22 22 18 17 18 17 27 22 23 23 23 22 23 23 
28 28 28 28 28 27 26 25 22 22 0 184 22 22 22 22 22 22 22 22 22 22 0 192 22 22 22 22 23 23 154 242 
28 28 28 28 28 27 25 180 213 209 22 120 208 206 22 121 22 22 22 22 0 207 22 130 0 100 124 22 28 22 23 23 
28 28 0 206 27 27 24 23 22 22 22 22 22 22 0 86 22 22 0 194 22 22 262 198 6 101 141 23 63 23 23 23 
28 28 160 192 27 39 23 22 184 179 22 122 8 18 17 17 47 43 45 49 22 22 0 189 23 22 0 205 23 23 0 235 
28 28 0 204 26 26 0 193 22 22 0 188 22 22 0 189 22 22 0 190 22 23 0 198 22 22 0 211 23 23 0 244 
28 27 0 190 26 25 0 184 22 22 0 179 22 22 0 181 22 22 0 184 23 22 0 192 22 23 0 207 23 23 0 239 
28 28 0 208 26 24 0 199 22 22 0 195 22 22 0 194 22 22 0 195 22 22 0 202 22 23 0 219 23 23 0 250 
28 28 0 197 24 23 0 188 22 22 0 186 22 22 0 186 22 22 0 188 22 22 0 196 22 22 0 213 23 23 0 246 
28 27 0 217 24 23 0 207 22 22 0 201 22 22 0 200 22 22 0 202 22 23 0 209 22 23 0 225 23 23 0 256 
28 28 0 204 23 22 0 195 22 22 0 192 22 22 0 192 22 22 0 195 22 22 0 204 23 23 0 221 23 23 0 254 
28 28 0 227 22 22 0 214 22 22 0 209 22 22 0 208 22 22 0 210 22 22 0 218 23 23 0 235 23 24 0 267 
28 27 0 213 22 22 0 203 22 22 0 200 22 22 0 198 23 22 0 202 23 23 0 212 23 23 0 230 24 24 0 264 
28 27 0 247 22 22 0 235 22 22 0 231 22 22 0 228 22 22 0 228 23 23 0 238 23 23 0 258 23 24 0 292 
========================

eeprom and frame looks like reasonable values, but after the To conversion only some pixel are getting 22-23 degree that is correct reading, all the other are strongly out of range. I also tried "lookup table method" but i'm getting same results. I have several sensors and several boards, so i already tried to change batteries, board or sensors, but I got same mistakes in same pixels. CC2538 has only 32kB ram but "size" command gives: text data bss dec hex filename 81868 1970 22452 106290 19f32 host.elf So it looks like ok. Any suggestions?

slavysis commented 3 years ago

Hi,

I tried the driver on several random MLX90640 devices and it is working. I also used the EEPROM and the frame data that you provided to feed it in the driver functions and check the outcome. I also did manual calculations as described in the datasheet. Both the manual calculations and the driver agree that based on that input data the temperatures should be:

Vdd = 3.305 Ta = 25.431 To = 28.763,28.694,28.991,28.945,28.804,28.724,28.632,28.502,28.323,27.966,27.542,26.696,23.479,22.934,22.378,22.758,22.697,22.404,22.676,23.043,22.640,22.874,23.113,23.062,23.201,23.211,23.235,23.437,23.614,23.597,23.598,24.736,28.719,28.244,29.382,28.696,28.575,28.522,28.642,28.664,28.472,28.138,26.866,26.346,22.657,22.649,22.475,22.636,22.402,22.477,22.782,22.540,22.720,22.584,22.622,22.914,22.880,22.889,23.332,23.049,23.685,23.680,24.214,24.496,28.863,28.706,28.944,28.961,28.197,28.197,28.814,28.449,28.186,28.001,26.274,24.932,22.699,22.388,22.352,22.713,22.721,22.433,22.277,22.817,22.775,22.825,22.878,22.870,23.359,23.132,23.181,22.966,23.482,23.265,23.715,24.044,28.414,28.705,28.765,28.734,28.712,28.730,28.984,28.761,28.181,28.007,25.304,23.579,22.407,22.451,22.773,22.582,22.605,22.651,22.195,22.687,22.661,22.534,22.767,23.090,23.022,22.794,23.059,23.016,23.526,23.555,23.811,23.591,28.701,28.557,28.447,28.246,28.642,28.207,28.371,28.538,27.768,27.612,23.367,22.928,22.520,22.493,22.427,22.691,22.626,22.592,22.419,22.445,22.892,22.557,22.291,22.801,22.903,23.073,22.713,23.328,22.978,23.201,24.058,24.122,28.478,28.562,28.811,28.600,28.284,28.553,28.733,28.536,27.600,26.636,23.108,22.472,22.401,22.205,22.193,22.579,22.359,22.476,22.507,22.831,22.929,22.435,22.544,22.310,22.762,22.941,22.800,22.978,23.466,23.695,23.663,23.912,28.713,28.585,28.338,28.873,28.203,28.322,27.948,28.116,26.895,25.110,22.487,22.523,22.922,22.380,22.362,22.694,22.097,22.263,22.678,22.843,22.661,22.460,22.544,22.866,22.792,22.820,22.844,23.394,23.466,23.458,23.437,23.745,28.535,28.419,28.546,28.335,28.214,28.005,28.472,28.119,26.109,24.168,22.238,22.237,22.656,22.449,22.456,22.422,22.295,22.470,22.583,22.553,22.889,22.533,22.452,22.732,22.493,22.708,22.932,23.241,23.317,22.901,24.167,23.781,28.430,28.355,28.265,28.609,28.620,28.438,28.022,27.722,24.144,22.684,22.054,22.449,22.497,22.340,22.599,22.637,22.593,22.340,22.264,22.595,22.525,22.376,22.121,22.765,22.690,23.076,22.533,23.241,23.128,23.320,23.286,23.571,28.620,28.385,28.468,28.451,28.313,28.311,28.058,27.407,23.388,22.428,22.444,22.643,22.540,22.218,22.502,22.345,22.325,22.245,22.358,22.627,22.575,22.589,22.352,22.627,22.732,22.605,23.159,23.103,23.172,23.165,23.567,23.821,28.019,28.140,28.070,28.558,27.806,27.919,27.062,26.099,22.606,22.228,21.952,22.461,22.171,22.220,22.177,22.204,22.165,22.037,22.764,22.610,22.434,22.457,22.486,23.021,22.923,22.584,22.975,23.518,23.157,22.795,23.112,23.812,28.224,28.191,28.117,28.235,28.164,27.632,26.629,24.986,22.334,22.596,22.352,22.501,22.528,22.579,22.089,22.395,22.523,22.407,22.525,22.803,22.480,22.351,22.560,22.714,22.805,22.302,22.857,22.824,23.009,23.230,23.400,23.631,28.174,28.125,28.069,28.371,27.901,27.425,25.442,23.964,22.419,22.462,21.962,22.685,22.384,22.255,22.361,22.386,22.361,22.386,22.142,22.506,22.261,22.306,22.817,22.986,22.922,22.608,23.137,22.791,23.010,22.817,23.349,23.581,27.867,28.200,28.121,28.227,27.450,27.474,24.685,23.168,22.299,22.360,22.514,22.412,22.421,22.301,22.416,22.410,22.548,22.107,22.691,22.557,22.466,22.513,22.880,23.013,22.784,22.650,23.017,23.176,23.243,23.062,23.841,23.824,28.026,27.769,28.220,28.072,26.962,26.776,23.172,22.646,22.319,22.275,22.312,22.466,22.220,22.446,22.194,22.564,22.367,22.371,22.276,22.495,22.283,22.586,22.665,22.641,22.908,22.793,23.319,22.963,23.168,23.008,23.560,24.010,27.716,27.849,28.108,28.276,26.666,26.170,22.920,22.521,22.363,22.332,22.531,22.663,22.401,22.186,22.428,22.920,22.725,22.413,22.657,22.532,22.641,22.954,23.054,22.838,22.774,22.501,23.008,23.167,23.006,23.246,24.067,23.832,27.901,27.643,27.752,27.743,25.967,24.961,22.612,22.481,22.556,22.605,22.746,22.509,22.358,22.528,22.478,22.531,22.638,22.511,22.306,22.802,22.911,22.566,22.637,22.857,22.772,22.918,23.114,23.281,23.758,23.309,23.736,23.978,27.959,27.892,27.814,27.431,25.846,24.035,22.856,22.353,22.597,22.654,22.644,22.863,22.235,22.108,22.402,22.262,22.529,22.556,22.693,22.359,22.631,22.624,22.711,22.727,22.825,22.997,23.175,23.115,23.013,23.558,23.801,23.801,28.139,27.850,27.822,27.250,24.613,23.228,22.802,22.609,22.346,22.350,22.686,22.731,22.307,22.347,22.612,22.670,22.804,22.329,22.407,22.579,22.723,22.852,22.765,22.945,22.854,22.520,23.791,23.226,23.282,23.264,23.477,24.401,28.210,27.583,27.372,26.780,23.963,23.118,22.514,23.158,22.395,22.230,22.423,22.754,22.357,22.398,22.675,22.701,22.675,22.528,22.444,22.768,22.775,22.923,23.010,22.823,22.893,23.121,23.287,23.054,23.516,23.321,24.232,23.977,27.693,27.800,26.984,26.231,23.041,22.662,22.596,22.726,22.617,22.666,22.449,22.975,22.891,22.537,22.708,22.715,22.589,22.190,22.845,22.795,22.841,22.496,23.241,23.040,22.944,23.288,23.740,23.550,23.843,23.623,24.348,24.370,27.774,27.905,26.895,26.111,22.560,22.545,22.839,22.416,22.521,22.416,22.853,22.343,22.605,22.608,22.612,22.919,22.314,22.579,22.918,23.009,22.910,22.755,22.944,23.597,23.157,23.328,23.803,23.778,23.247,24.107,23.952,24.655,27.779,27.514,26.303,25.118,22.728,22.314,22.401,22.224,22.591,22.379,22.591,22.799,22.652,22.644,22.959,22.642,22.980,22.465,22.762,23.119,23.117,23.083,23.116,23.299,23.441,23.007,24.269,23.917,24.458,23.974,24.530,25.328,27.895,27.461,25.653,24.638,22.801,22.599,22.510,22.485,22.320,22.646,22.538,22.561,22.725,22.233,22.707,22.891,22.536,22.545,22.850,23.181,23.003,22.982,23.029,23.185,23.491,23.475,23.526,23.772,23.657,24.072,24.891,25.171

You mentioned that you started off of the MLX90641 deriver working. Is it possible that you somehow mixed-up the two drivers?

Best regards

luigi-grim commented 3 years ago

Thank you very much for your time, I could focus on libraries since my reading is correct and I realized the T0 computation screws calculation when it starts using kTa and Kv arrays. In fact those arrays doesn't look right at all. I will look better into their calculation, maybe my C dialect makes something wrong, but I have a big doubt: according to the excel file with example values, kTa and kV should be both 0.something, so float, but in the params struct their type is actually int8_t. If I force those data to zero in the T0 calculation the reading is very good, probably with little errors here and there. Any idea why they are int in the params struct instead of float, as the excel example suggest they should be?

slavysis commented 3 years ago

HI, indeed the xls file is not valid anymore - since the update for reducing the RAM footprint. You first need to calculate the correct Vdd and Ta values. For the input data you shared Vdd should be 3.305 and Ta should be 24.31. In your case you have error in Vdd (which maybe explains the error in Ta). So I would suggest that you first look into Vdd.

Best regards