Jump to content



Photo
- - - - -

Pinscape on KL25Z install - not detected at step 5


  • Please log in to reply
64 replies to this topic

#21 nbruk

nbruk

    Hobbyist

  • Members
  • PipPip
  • 17 posts

  • Flag: United Kingdom

  • Favorite Pinball: Batman

Posted 15 March 2025 - 10:23 AM

I’m guessing that you didn’t enable I2C0. Find the comment block for i2c0:, uncomment it, and fill in the GPIOs you’re using. 

 You were right - thanks mjr.

 

Configuration is showing fine in the log now, but I'm getting device intitialisation failed.  I've tried using the other gpios instead, and running with the INT wire connected and disconnected with matching config, and lowering the IR current but still the same. I'm guessing I have a duff sensor.



#22 mjr

mjr

    Pinball Wizard

  • Members
  • PipPipPipPipPip
  • 3,260 posts

  • Flag: United States of America

  • Favorite Pinball: Medieval Madness

Posted 15 March 2025 - 05:25 PM

 
> Configuration is showing fine in the log now, but I'm getting device intitialisation failed
 
Try turning on "debug" in the log filter - that might show some more detail about what's going wrong in the sensor setup.  Post the messages and I'll take a look.  I'll also give it a try on my setup when I have a chance to make sure it's still working - I might have broken something in there since the last time I tried it and haven't noticed yet.


#23 nbruk

nbruk

    Hobbyist

  • Members
  • PipPip
  • 17 posts

  • Flag: United Kingdom

  • Favorite Pinball: Batman

Posted 17 March 2025 - 11:00 AM

Thanks mjr, logs with debug as follows:

 

===========================================
PinscapePico v0.1.7, build 202502282039
 
2025/03/17 10:57:27 Info:    Flash JEDEC ID recognized as Winbond W25Q16JV-IQ/JQ, capacity 2097152 bytes
2025/03/17 10:57:27 Info:    SFDP basic parameters table found, capacity entry found [4:7]{ ff ff ff 00 }, 2097152 bytes
2025/03/17 10:57:27 Info:    Flash file system mounted; 131072 bytes allocated to 2 files
2025/03/17 10:57:27 Debug:   File "config.json" opened for read, 32327 us
2025/03/17 10:57:27 Config:  Config file loaded OK; parsed JSON memory usage: 5,312 bytes
2025/03/17 10:57:27 Info:    I2C0 bus reset OK, 0 clocks sent
2025/03/17 10:57:27 Config:  I2C0 configured on SDA=GP4, SCL=GP5; speed: 400000; DMA channels: TX 0, RX 1
2025/03/17 10:57:27 Error:   VCNL4010 device initialization failed; Product ID 0, Rev 0, IR current 200 mA
2025/03/17 10:57:27 Config:  Open Pinball Device HID configured
2025/03/17 10:57:27 Config:  USB CDC console enabled, output buffer size 8192, history size 256
2025/03/17 10:57:27 Info:    Kb LED 01
2025/03/17 10:57:28 Debug:   File "config.json" opened for read, 36767 us


#24 mjr

mjr

    Pinball Wizard

  • Members
  • PipPipPipPipPip
  • 3,260 posts

  • Flag: United States of America

  • Favorite Pinball: Medieval Madness

Posted 17 March 2025 - 06:27 PM

> logs with debug as follows:

 

Thanks for trying that.  Looks like the startup code isn't able to access the device registers (the product ID 0), so either it's just something wrong in the code, or it's a hardware problem with the device. One thing you could try is to open a PuTTY window (or any other terminal emulator) on the console device on the USB COM port (I see in the log you already have that configured), and run the command i2c0 --bus-scan.  That'll scan for all devices on the I2C bus and show their addresses, so we can at least find out if it's responding at all at the basic I2C level, by seeing if the scan finds anything at the VCNL4010 I2C address (0x13).



#25 nbruk

nbruk

    Hobbyist

  • Members
  • PipPip
  • 17 posts

  • Flag: United Kingdom

  • Favorite Pinball: Batman

Posted 18 March 2025 - 08:03 AM

Thanks mjr - output as follows:

 

Pinscape Pico command console - Firmware v0.1.7, build 202502282039
Unit #1, Main Pico
> i2c0 --bus-scan
Starting bus scan on I2C0
2025/03/18 11:03:15 Info:    I2C0 bus scan: found device at 0x13
2025/03/18 11:03:15 Info:    I2C0 bus scan completed
 
So looks like it's found a device of some description.

Edited by nbruk, 18 March 2025 - 11:27 AM.


#26 mjr

mjr

    Pinball Wizard

  • Members
  • PipPipPipPipPip
  • 3,260 posts

  • Flag: United States of America

  • Favorite Pinball: Medieval Madness

Posted 18 March 2025 - 07:20 PM

> Starting bus scan on I2C0
> 2025/03/18 11:03:15 Info:    I2C0 bus scan: found device at 0x13
 
That's good information - it says that the sensor has power and has a good physical connection to the Pico, so it's looking more likely that it's a software problem on the Pico side. I still need to give it a try on my end. One more quick console test you can do in the meantime is try a manual register fetch from the device to see if it's reading properly:
 
ic20 --rx $13 $81 1
 
That'll try to read a byte from the sensor's product ID/revision register (0x81).  That's the same thing the startup code does right at the outset, so we can see if it's still failing after startup completes.  A VCNL4010 or 4020 should report 0x21 in that register.


#27 nbruk

nbruk

    Hobbyist

  • Members
  • PipPip
  • 17 posts

  • Flag: United Kingdom

  • Favorite Pinball: Batman

Posted 18 March 2025 - 08:49 PM

Thanks again mjr - latest output:

 

> i2c0 --rx $13 $81 1
0000/01/01 00:05:00 Info:    Ad hoc I2C RX from 0x13 OK [21]


#28 mjr

mjr

    Pinball Wizard

  • Members
  • PipPipPipPipPip
  • 3,260 posts

  • Flag: United States of America

  • Favorite Pinball: Medieval Madness

Posted 18 March 2025 - 09:01 PM

Interesting - looks like the device is communicating properly. I might have to add some instrumentation to figure out why it’s reporting errors at initialization. I’ll investigate a bit and get back to you.



#29 nbruk

nbruk

    Hobbyist

  • Members
  • PipPip
  • 17 posts

  • Flag: United Kingdom

  • Favorite Pinball: Batman

Posted 18 March 2025 - 09:03 PM

Awesome - thanks mjr, appreciate the support :)



#30 mjr

mjr

    Pinball Wizard

  • Members
  • PipPipPipPipPip
  • 3,260 posts

  • Flag: United States of America

  • Favorite Pinball: Medieval Madness

Posted 18 March 2025 - 11:20 PM

Okay, I think I found the issue.  Two issues, actually - one was an outright bug, and one was just a timing issue with the VCNL4010 itself, which the Vishay application note mentions might need a couple of milliseconds to respond to commands after a reset.  Both should be fixed in the new firmware update I just posted (v0.1.9), and I confirmed it's working again in my test setup.  Give it a try and let me know if that does the trick for you.


(I also added more detailed debug logging to the startup command sequencing, so if it's still not working on your system, there should at least be some more information in the log to look at.)



#31 nbruk

nbruk

    Hobbyist

  • Members
  • PipPip
  • 17 posts

  • Flag: United Kingdom

  • Favorite Pinball: Batman

Posted 19 March 2025 - 10:10 AM

Thanks mjr - updated to 1.9 and the logs look better:

 

===========================================
PinscapePico v0.1.9, build 202503181558
 
2025/03/19 09:21:04 Info:    Flash JEDEC ID recognized as Winbond W25Q16JV-IQ/JQ, capacity 2097152 bytes
2025/03/19 09:21:04 Info:    SFDP basic parameters table found, capacity entry found [4:7]{ ff ff ff 00 }, 2097152 bytes
2025/03/19 09:21:04 Info:    Flash file system mounted; 131072 bytes allocated to 2 files
2025/03/19 09:21:04 Debug:   File "config.json" opened for read, 32322 us
2025/03/19 09:21:04 Config:  Config file loaded OK; parsed JSON memory usage: 5,312 bytes
2025/03/19 09:21:04 Info:    I2C0 bus reset OK, 0 clocks sent
2025/03/19 09:21:04 Config:  I2C0 configured on SDA=GP4, SCL=GP5; speed: 400000; DMA channels: TX 0, RX 1
2025/03/19 09:21:04 Config:  VCNL4010 device initialization OK; I2C0 addr 0x13, Product ID 2, Rev 1, IR current 200 mA
2025/03/19 09:21:04 Config:  Open Pinball Device HID configured
2025/03/19 09:21:04 Config:  USB CDC console enabled, output buffer size 8192, history size 256
2025/03/19 09:21:04 Info:    Kb LED 01
 
 
 
However "Sensor Type" still shows blank on the plunger tab and I can't see any readings.


#32 mjr

mjr

    Pinball Wizard

  • Members
  • PipPipPipPipPip
  • 3,260 posts

  • Flag: United States of America

  • Favorite Pinball: Medieval Madness

Posted 19 March 2025 - 05:59 PM

Do you have a plunger: { } section in your config?  That's needed to enable the abstract plunger device (separately from the physical sensor).  Just something like this should be all you need:

plunger: {
    source: "vcnl4010",  // optional, inferred automatically if only one physical sensor type is configured
},


#33 nbruk

nbruk

    Hobbyist

  • Members
  • PipPip
  • 17 posts

  • Flag: United Kingdom

  • Favorite Pinball: Batman

Posted 19 March 2025 - 08:18 PM

That did the the trick - thanks mjr!!!! :)

 

I can see the sensor type and the output in the Plunger tab now. I am getting 2 lines in the log regarding loading the  "vcnl4010.cal" file but it doesn't seem to affect functionality (I did think there was an issue with the joy.cpl axes but working after calibration).

===========================================
PinscapePico v0.1.9, build 202503181558
 
2025/03/19 19:54:26 Info:    Flash JEDEC ID recognized as Winbond W25Q16JV-IQ/JQ, capacity 2097152 bytes
2025/03/19 19:54:26 Info:    SFDP basic parameters table found, capacity entry found [4:7]{ ff ff ff 00 }, 2097152 bytes
2025/03/19 19:54:26 Info:    Flash file system mounted; 131072 bytes allocated to 2 files
2025/03/19 19:54:26 Debug:   File "config.json" opened for read, 32120 us
2025/03/19 19:54:26 Config:  Config file loaded OK; parsed JSON memory usage: 5,328 bytes
2025/03/19 19:54:26 Info:    I2C0 bus reset OK, 0 clocks sent
2025/03/19 19:54:26 Config:  I2C0 configured on SDA=GP4, SCL=GP5; speed: 400000; DMA channels: TX 0, RX 1
2025/03/19 19:54:26 Config:  VCNL4010 device initialization OK; I2C0 addr 0x13, Product ID 2, Rev 1, IR current 200 mA
2025/03/19 19:54:26 Config:  Open Pinball Device HID configured
2025/03/19 19:54:26 Config:  USB CDC console enabled, output buffer size 8192, history size 256
2025/03/19 19:54:26 Config:  Plunger: VCNL4010 sensor source selected
2025/03/19 19:54:26 Debug:   File "vcnl4010.cal" not found in open for read
2025/03/19 19:54:26 Info:    Flash struct 'vcnl4010.cal' not found (flash storage status code -1); using defaults
2025/03/19 19:54:26 Config:  No saved plunger calibration data found; using defaults
2025/03/19 19:54:26 Info:    Kb LED 01
2025/03/19 19:54:27 Debug:   File "config.json" opened for read, 36507 us

Edited by nbruk, 19 March 2025 - 08:45 PM.


#34 nbruk

nbruk

    Hobbyist

  • Members
  • PipPip
  • 17 posts

  • Flag: United Kingdom

  • Favorite Pinball: Batman

Posted 19 March 2025 - 10:15 PM

Update - it's working really well now. Thanks again for all your support and for writing Pinscape mjr :)

 

I've created a design for a 3d printed plunger reflector - just a simple 50mm flat disk on a 7mm diameter tube which slides onto the tip of the plunger. I used 2 layers of insulating tape on the plunger rod to make it a tighter fit and it works really well. I'll send you the STL file to include with the Pinscap Build Guide if you PM me your email address.



#35 mjr

mjr

    Pinball Wizard

  • Members
  • PipPipPipPipPip
  • 3,260 posts

  • Flag: United States of America

  • Favorite Pinball: Medieval Madness

Posted 20 March 2025 - 12:22 AM

Great - glad it's working!

 

> I am getting 2 lines in the log regarding loading the  "vcnl4010.cal" file but it doesn't seem to affect functionality

 

Right, that's just reporting that no calibration data exists for that sensor yet.  When you run calibration and save the results, that's where they'll be stored.

 

(Just in general, "Info" reports in the log reflect status information where the software isn't even slightly suspicious that anything is wrong, but which you nonetheless might like to know about, purely in case YOU were expecting something different.  If the software thinks anything is suspicious but isn't sure, those messages will use the "Warning" category, and when the software is sure that something is wrong, they'll say "Error".)

 

> I've created a design for a 3d printed plunger reflector

 

Good idea!


Edited by mjr, 20 March 2025 - 12:28 AM.


#36 nbruk

nbruk

    Hobbyist

  • Members
  • PipPip
  • 17 posts

  • Flag: United Kingdom

  • Favorite Pinball: Batman

Posted 20 March 2025 - 08:17 AM

Thanks mjr - that makes sense.

 

Very happy to have a working plunger on my first Vpin build :)

 

My LIS3DH module arrives next week too.



#37 nbruk

nbruk

    Hobbyist

  • Members
  • PipPip
  • 17 posts

  • Flag: United Kingdom

  • Favorite Pinball: Batman

Posted 28 March 2025 - 12:39 PM

Hi mjr,

 

Hitting an issue with configuring my LIS3DH module - I'm getting the error below:

 

PinscapePico v0.1.9, build 202503181558
 
2025/03/28 12:27:57 Info:    Flash JEDEC ID recognized as Winbond W25Q16JV-IQ/JQ, capacity 2097152 bytes
2025/03/28 12:27:57 Info:    SFDP basic parameters table found, capacity entry found [4:7]{ ff ff ff 00 }, 2097152 bytes
2025/03/28 12:27:57 Info:    Flash file system mounted; 135168 bytes allocated to 3 files
2025/03/28 12:27:57 Debug:   File "config.json" opened for read, 31867 us
2025/03/28 12:27:57 Config:  Config file loaded OK; parsed JSON memory usage: 5,360 bytes
2025/03/28 12:27:57 Info:    I2C0 bus reset OK, 0 clocks sent
2025/03/28 12:27:57 Config:  I2C0 configured on SDA=GP4, SCL=GP5; speed: 400000; DMA channels: TX 0, RX 1
2025/03/28 12:27:57 Info:    I2C1 bus reset OK, 0 clocks sent
2025/03/28 12:27:57 Config:  I2C1 configured on SDA=GP18, SCL=GP19; speed: 100000; DMA channels: TX 2, RX 3
2025/03/28 12:27:57 Error:   LIS3DH device initialization failed; interrupt N/A, dynamic range +/- 2g
2025/03/28 12:27:57 Config:  VCNL4010 device initialization OK; I2C0 addr 0x13, Product ID 2, Rev 1, IR current 200 mA
2025/03/28 12:27:57 Config:  Open Pinball Device HID configured
2025/03/28 12:27:57 Config:  USB CDC console enabled, output buffer size 8192, history size 256
2025/03/28 12:27:57 Config:  Plunger: VCNL4010 sensor source selected
2025/03/28 12:27:57 Debug:   File "vcnl4010.cal" opened for read, 155 us
2025/03/28 12:27:57 Info:    Kb LED 01
 
Any ideas please? I haven't connected the Interrupt pin and have used -1 in the config to represent that. The only pins I've connected are 3.3v, GND, SDA and SDL.
 
Thanks, nbr_uk


#38 diabbb2

diabbb2

    Neophyte

  • Members
  • Pip
  • 1 posts

  • Flag: ---------

  • Favorite Pinball: Baywatch

Posted 28 March 2025 - 01:54 PM

FYI: Conrad in germany also sells the bad version of KL25Z.



#39 mjr

mjr

    Pinball Wizard

  • Members
  • PipPipPipPipPip
  • 3,260 posts

  • Flag: United States of America

  • Favorite Pinball: Medieval Madness

Posted 28 March 2025 - 05:52 PM

> I haven't connected the Interrupt pin and have used -1 in the config to represent that. 

 

It's fine not to connect the interrupt, but you should just omit the 'interrupt' property in that case (don't use -1).

 

> 2025/03/28 12:27:57 Error:   LIS3DH device initialization failed; interrupt N/A, dynamic range +/- 2g

 

I'm not seeing a WHOAMI register message in the log, so the problem is that the I2C communications with the device aren't working.  Make sure you have the right bus number set in the "i2c" property, and make sure you have pull-up resistors on the bus, either external resistors or by enabling the Pico's internal ones via the "i2c0: { pullup: true }" option.  If you're using the Adafruit LIS3DH breakout board, it has the necessary resistors built in, but other ones might or might not.  It usually won't hurt to enable the internal Pico pullups either way, since they're weak, so you can give that a try if you're not sure about the board.

 

If you want to check the I2C comms manually, enable the USB CDC port with console enabled (see the JSON Config Reference help under Serial Ports).  That will let you open a PuTTY window onto a command console to run some debug commands.  To check the bus, you can run:

 

i2c0 --bus-scan

 

That will report all of the devices it finds on the bus.  LIS3DH has an address of either 0x18 or 0x19 depending on how the SDO/SA0 pin is wired, so you should see one of those in the list if the device is responding.  If so, you can try reading its WHOAMI register to see if it's returning valid data:

 

i2c0 --rx $18 $0F 1

 

That should reply with 0x33 if the device is working properly.



#40 nbruk

nbruk

    Hobbyist

  • Members
  • PipPip
  • 17 posts

  • Flag: United Kingdom

  • Favorite Pinball: Batman

Posted 30 March 2025 - 05:07 PM

Thanks mjr - I've tried enabling the pico's built in resistors but still the same issue. Will investigate test the comms next.

 

Is it possible to run both LIS3DH and VCNL4010 on the i2c0 bus simultaniously? I'm currently running VCNL4010 in ic20 and trying to get LIS3DH running on i2c1 as assumed I need to separate them.