Additional outputs using a SX1509B Expander
-
-
@alankilian true, but as far as I understand (see this note on the very same page this no longer works for RepRap Firmware 3.x
-
This post is deleted! -
@t0bias Yeah, I have no specific knowledge on this. Just trying to help.
Let us know when you figure it out.
-
Maybe use M122 and look for the I2C debugging information to see if your I2C is running properly?
I2C nak errors 0, send timeouts 0, receive timeouts 0, finishTimeouts 0, resets 0
-
Good point!
Unfortunately no luck here either..I2C nak errors 0, send timeouts 0, receive timeouts 0, finishTimeouts 0, resets 0
-
@t0bias Are the outputs set to open-drain by default or something?
(I'll go take a peek at the firmware to see how they are initialized next.)
-
Not that I was aware of..
However, I just checked the datasheet and according to it, all pins are configured as inputs upon power-on, so I think I would need to configure them as outputs. I don't really know what the duet firmware is doing internally here.. -
@t0bias said in Additional outputs using a SX1509B Expander:
I think I would need to configure them as outputs
When you say P5 instead of J5 it is configured as an output (I think).
Maybe add the "^" character to the M950 would do it?
C"name" Pin name(s) and optional inversion status, see Pin Names. Pin name "nil" frees up the pin. A leading '!' character inverts the input or output. A leading '^' character enables the pullup resistor. The '^' and '!' characters may be placed in either order.
-
I may be wrong, but I think pull-up resistors can only be enabled on ports of the Duet board itself.
There are source-files specifically for this expansion chip (here), however I have no idea what the "DuetNG" denomination is about to be honest. Also, this branch seems to be of the 2.x firmware only? -
@t0bias, which firmware version are you using? In particular, part of that code was rewritten between versions 3.2.2 and 3.3beta1, so what works in one might not work in the other.
I can increase the number of available GpOut ports in the next 3.3beta. Would 20 be sufficient?
-
@dc42 thanks for your reply. I am using version 3.1.1, would a upgrade fix the issue?
yes, 20 would be sufficient, maybe a bit more would be even better still? -
@t0bias said in Additional outputs using a SX1509B Expander:
@dc42 thanks for your reply. I am using version 3.1.1, would a upgrade fix the issue?
An upgrade to 3.3beta1 might possibly fix it, if it doesn't then let me know and I'll implement a fix in 3.3beta2.
yes, 20 would be sufficient, maybe a bit more would be even better still?
Memory is rather tight on the Duet 2, so I'll set it to 20 in 3.3beta2. It's already 32 on Duet 3 and 3 Mini.
-
I upgraded to 3.3beta1 today, but it still doesn't work unfortunately
-
Thanks, this is on my list to test/investigate.
-
I have just tested this, and ports sx1509b.0, .1 and .2 all work for me using RRF 3.2.2 and also using RRF 3.3beta1. I didn't test the other ports.
Points to note:
- M115 will report the SX1509B if it is detected:
04/03/2021, 11:17:06 m115 FIRMWARE_NAME: RepRapFirmware for Duet 2 WiFi/Ethernet FIRMWARE_VERSION: 3.3beta1 ELECTRONICS: Duet WiFi 1.02 or later + DueX5 + SX1509B expander FIRMWARE_DATE: 2021-02-14 16:00:49
- My test system includes a very old DueX5. On these old boards, the TWC and TWD pins are labelled the wrong way round on the 10-pin expansion header. They are also labelled incorrectly on the wiring diagrams at https://duet3d.dozuki.com/Wiki/Duex_wiring_diagrams for the 0.6 and 0.7 boards. On all DueX revisions, TWC (aka SCL) is next to the ground pin at the end of the header.
-
Strange, the SX1509B is in fact detected:
FIRMWARE_NAME: RepRapFirmware for Duet 2 WiFi/Ethernet FIRMWARE_VERSION: 3.3beta1 ELECTRONICS: Duet WiFi 1.02 or later + SX1509B expander FIRMWARE_DATE: 2021-02-14 16:00:49
however the pins don't get driven high (or low) using the M42 commands.
I am confident the I²C-Wiring is correct, since I tried using a MCP23017 based relay board that responds to I²C-Commands just fine.Any suggestions or ideas are highly appreciated!
-
@t0bias
Have you checked the I2C address?
It has to be set to 0x71Here some code to test it directly with M260
https://forum.duet3d.com/topic/13911/sx1509-on-maestro-does-it-work/3 -
@t0bias, if the board is detected then the I2C pins are connected correctly and the slave address is set correctly.
How are you testing the outputs of the SX1509B? I have connected each output through a 100 ohm resistor to one of the cathodes of a 2-digit common anode 7-segment display, with the anodes connected to +3.3V.