DavidArmstrong / SCL3300

Arduino library for interfacing with the Murata SCL3300 Inclinometer via SPI
MIT License
20 stars 11 forks source link

Connection issues - crcerr #5

Closed janz0 closed 4 years ago

janz0 commented 4 years ago

I've tried with a couple different boards, a couple esp32 boards (huzzah32), uno (with logic level converter). I seem to receive the crc error with all transmissions as a result I am unable to connect to the SCL3300 properly.

Do you have any tips to obtain a connection?

Below is an attempt to connect (including debug data): 15:00:06.986 -> Reading Raw register values from SCL3300 Inclinometer 15:00:06.986 -> B4000338 B4 0 3 38 3 0 82 C 1 82 C 61 1 15:00:07.035 -> 180000E5 18 0 0 E5 2 8 20 83 1 820 83 2F 1 15:00:07.035 -> 180000E5 18 0 0 E5 2 8 20 83 1 820 83 2F 1 15:00:07.035 -> 180000E5 18 0 0 E5 2 8 20 83 1 820 83 2F 1 15:00:07.035 -> B0001F6F B0 0 1F 6F 2 8 20 C0 1 820 C0 2F 1 15:00:07.035 -> Murata SCL3300 inclinometer not connected.

A great library once I have the SPI transmitting and receiving properly I think.

janz0 commented 4 years ago

I should also note that I'm using the evaluation pcb. I've tested the two pcb's I have with the muRata evaluation unit and had no issues.

DavidArmstrong commented 4 years ago

Do you have a pullup resistor on the SPI slave select line? I found some boards require it to get SPI to work at all. Others are fine without it.

Dave

On Mon, Mar 2, 2020, 12:13 PM janz0 notifications@github.com wrote:

I should also note that I'm using the evaluation pcb. I've tested the two pcb's I have with the muRata evaluation unit and had no issues.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/DavidArmstrong/SCL3300/issues/5?email_source=notifications&email_token=AACGQKPR4WFUH23XBSJEEPTRFQHQFA5CNFSM4K73RGLKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENQYZOY#issuecomment-593595579, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACGQKI5ZD7TPIX6VCFGCN3RFQHQFANCNFSM4K73RGLA .

janz0 commented 4 years ago

That was going to be my attempts tomorrow.

In the specs it says something along the lines of “If you receive a checksum error on MISO then there are communication issues.” I’m hoping that is my issue and I’ll have it working after this!

If you don’t mind my asking, what boards/setup are you using for testing?

Mike

Sent from my iPhone

On Mar 2, 2020, at 6:43 PM, Dave Armstrong notifications@github.com wrote:

Do you have a pullup resistor on the SPI slave select line? I found some boards require it to get SPI to work at all. Others are fine without it.

Dave

On Mon, Mar 2, 2020, 12:13 PM janz0 notifications@github.com wrote:

I should also note that I'm using the evaluation pcb. I've tested the two pcb's I have with the muRata evaluation unit and had no issues.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/DavidArmstrong/SCL3300/issues/5?email_source=notifications&email_token=AACGQKPR4WFUH23XBSJEEPTRFQHQFA5CNFSM4K73RGLKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENQYZOY#issuecomment-593595579, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACGQKI5ZD7TPIX6VCFGCN3RFQHQFANCNFSM4K73RGLA .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/DavidArmstrong/SCL3300/issues/5?email_source=notifications&email_token=AE7NXA6CVLIKAQOEGBP7H3DRFRABDA5CNFSM4K73RGLKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENRNTAI#issuecomment-593680769, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AE7NXA2BZLEP4D6QXGWMMDTRFRABDANCNFSM4K73RGLA.

DavidArmstrong commented 4 years ago

I've used an Arduino Pro mini and a Sparkfun Redboard Turbo for testing. Be careful of using 1/8th watt resistors on a breadboard, as the thin leads don't make a good connection.

Another useful test is a loop back test. Take out the inclinometer and tie MISO and MOSI together on the SPI interface. The library will still 'fail' because the whoami register won't be the expected value. But CRC errors should go away.

Dave

On Mon, Mar 2, 2020, 4:07 PM janz0 notifications@github.com wrote:

That was going to be my attempts tomorrow.

In the specs it says something along the lines of “If you receive a checksum error on MISO then there are communication issues.” I’m hoping that is my issue and I’ll have it working after this!

If you don’t mind my asking, what boards/setup are you using for testing?

Mike

Sent from my iPhone

On Mar 2, 2020, at 6:43 PM, Dave Armstrong notifications@github.com wrote:

Do you have a pullup resistor on the SPI slave select line? I found some boards require it to get SPI to work at all. Others are fine without it.

Dave

On Mon, Mar 2, 2020, 12:13 PM janz0 notifications@github.com wrote:

I should also note that I'm using the evaluation pcb. I've tested the two pcb's I have with the muRata evaluation unit and had no issues.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub < https://github.com/DavidArmstrong/SCL3300/issues/5?email_source=notifications&email_token=AACGQKPR4WFUH23XBSJEEPTRFQHQFA5CNFSM4K73RGLKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENQYZOY#issuecomment-593595579>,

or unsubscribe < https://github.com/notifications/unsubscribe-auth/AACGQKI5ZD7TPIX6VCFGCN3RFQHQFANCNFSM4K73RGLA>

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub< https://github.com/DavidArmstrong/SCL3300/issues/5?email_source=notifications&email_token=AE7NXA6CVLIKAQOEGBP7H3DRFRABDA5CNFSM4K73RGLKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENRNTAI#issuecomment-593680769>, or unsubscribe< https://github.com/notifications/unsubscribe-auth/AE7NXA2BZLEP4D6QXGWMMDTRFRABDANCNFSM4K73RGLA>.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/DavidArmstrong/SCL3300/issues/5?email_source=notifications&email_token=AACGQKLYD6LMO3XU33HHL5DRFRC3LA5CNFSM4K73RGLKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENRQYKI#issuecomment-593693737, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACGQKNXOELNZ5G2WPQZJSLRFRC3LANCNFSM4K73RGLA .

DavidArmstrong commented 4 years ago

Here is a comparison of 'good' debug data being output: Reading Raw register values from SCL3300 Inclinometer B4000338 B4 0 3 38 FF 0 0 FF 1 0 FF FF 0 180000E5 18 0 0 E5 B7 0 3 B4 1 3 B4 B4 0 180000E5 18 0 0 E5 1B 0 40 7A 1 40 7A 7A 0 180000E5 18 0 0 E5 19 0 40 79 1 40 79 79 0 B0001F6F B0 0 1F 6F 19 0 0 6A 1 0 6A 6A 0 40000091 40 0 0 91 B1 0 1F E0 1 1F E0 E0 0 40000091 40 0 0 91 41 0 C1 36 1 C1 36 36 0 FC000073 FC 0 0 73 41 0 C1 36 1 C1 36 36 0 40000091 40 0 0 91 FD 0 0 FC 1 0 FC FC 0 40000091 40 0 0 91 41 0 C1 36 1 C1 36 36 0 Inclinometer is still alive...

The last number in each line tells whether or not the CRC value is valid, zero is good, a '1' isn't. The two sets of hex numbers before that tell you the reported CRC that was in the 32-bit word returned, and the computed CRC. They should always be the same value. If not, then something is wrong in the SPI communication channel.

janz0 commented 4 years ago

You are correct, it was an issue with the spi communications. I did the following as tests:

  1. Connected the MOSI directly to the MISO on my esp32 to check the board was communicating, no errors.
  2. Added code to allow for three attempts to startup the inclinometer "inclinometer.begin()"
  3. Added a pull up resistor on the chip select. This decreased the checksum errors, intermittently the examples would pass into readings.
  4. Added a pull down resistor on the MISO line. This further decreased errors, example scripts typically operated. After a random interval it would still fail the WHOAMI check while grabbing data and would not recover.
  5. Complete redesign with a larger bread board and better connectors. Example scripts operated normally without 1 through 4 required.

I believe I must have had a cheap/faulty connector in the mix that was disrupting my connection. All is operating as expected now.

Your library came a the perfect time for myself, I'll let you know if I come across any other issues.

Output for Tilt Level Offset as reference: 14:50:54.049 -> Reading basic Tilt Level Offset values from SCL3300 Inclinometer 14:50:54.095 -> B4000338 B4 0 3 38 41 0 C1 36 1 C1 36 36 0 14:50:54.095 -> 180000E5 18 0 0 E5 B5 0 3 B7 1 3 B7 B7 0 14:50:54.095 -> 180000E5 18 0 0 E5 19 0 0 6A 1 0 6A 6A 0 14:50:54.095 -> 180000E5 18 0 0 E5 19 0 0 6A 1 0 6A 6A 0 14:50:54.095 -> B0001F6F B0 0 1F 6F 19 0 0 6A 1 0 6A 6A 0 14:50:54.095 -> 40000091 40 0 0 91 B1 0 1F E0 1 1F E0 E0 0 14:50:54.095 -> 40000091 40 0 0 91 41 0 C1 36 1 C1 36 36 0 14:50:54.095 -> B4000338 B4 0 3 38 41 0 C1 36 1 C1 36 36 0 14:50:54.095 -> 180000E5 18 0 0 E5 B5 0 3 B7 1 3 B7 B7 0 14:50:54.141 -> 180000E5 18 0 0 E5 19 0 0 6A 1 0 6A 6A 0 14:50:54.141 -> 180000E5 18 0 0 E5 19 0 0 6A 1 0 6A 6A 0 14:50:54.141 -> B0001F6F B0 0 1F 6F 19 0 0 6A 1 0 6A 6A 0 14:50:54.141 -> 40000091 40 0 0 91 B1 0 1F E0 1 1F E0 E0 0 14:50:54.141 -> 40000091 40 0 0 91 41 0 C1 36 1 C1 36 36 0 14:50:54.141 -> B4000338 B4 0 3 38 41 0 C1 36 1 C1 36 36 0 14:50:54.141 -> 180000E5 18 0 0 E5 B5 0 3 B7 1 3 B7 B7 0 14:50:54.188 -> 180000E5 18 0 0 E5 19 0 0 6A 1 0 6A 6A 0 14:50:54.188 -> 180000E5 18 0 0 E5 19 0 0 6A 1 0 6A 6A 0 14:50:54.188 -> B0001F6F B0 0 1F 6F 19 0 0 6A 1 0 6A 6A 0 14:50:54.188 -> 40000091 40 0 0 91 B1 0 1F E0 1 1F E0 E0 0 14:50:54.188 -> 40000091 40 0 0 91 41 0 C1 36 1 C1 36 36 0 14:50:54.188 -> B4000338 B4 0 3 38 41 0 C1 36 1 C1 36 36 0 14:50:54.188 -> 180000E5 18 0 0 E5 B5 0 3 B7 1 3 B7 B7 0 14:50:54.235 -> 180000E5 18 0 0 E5 19 0 0 6A 1 0 6A 6A 0 14:50:54.235 -> 180000E5 18 0 0 E5 19 0 0 6A 1 0 6A 6A 0 14:50:54.235 -> B0001F6F B0 0 1F 6F 19 0 0 6A 1 0 6A 6A 0 14:50:54.235 -> 40000091 40 0 0 91 B1 0 1F E0 1 1F E0 E0 0 14:50:54.235 -> 40000091 40 0 0 91 41 0 C1 36 1 C1 36 36 0 14:50:54.235 -> FC000073 FC 0 0 73 41 0 C1 36 1 C1 36 36 0 14:50:54.235 -> 40000F7 4 0 0 F7 FD 0 0 FC 1 0 FC FC 0 14:50:54.235 -> 80000FD 8 0 0 FD 5 FE 9A 4C 1 FE9A 4C 4C 0 14:50:54.235 -> C0000FB C 0 0 FB 9 FA 72 31 1 FA72 31 31 0 14:50:54.235 -> 100000E9 10 0 0 E9 D 2E 45 94 1 2E45 94 94 0 14:50:54.235 -> 140000EF 14 0 0 EF 11 FF 9B 3 1 FF9B 3 3 0 14:50:54.235 -> 240000C7 24 0 0 C7 15 15 F3 ED 1 15F3 ED ED 0 14:50:54.235 -> 280000CD 28 0 0 CD 25 FE C9 85 1 FEC9 85 85 0 14:50:54.235 -> 2C0000CB 2C 0 0 CB 29 FB 1C 7F 1 FB1C 7F 7F 0 14:50:54.235 -> 180000E5 18 0 0 E5 2D 3A F7 6B 1 3AF7 6B 6B 0 14:50:54.235 -> 40000091 40 0 0 91 19 0 0 6A 1 0 6A 6A 0 14:50:54.235 -> 40000091 40 0 0 91 41 0 C1 36 1 C1 36 36 0 14:50:54.235 -> X Tilt: -1.71 Y Tilt: -6.88 Z Tilt: 82.92