Welcome! Log In Create A New Profile

Advanced

Question about 2nd Z-driver and IO for ANET A6

Posted by DutchForeigner 
Question about 2nd Z-driver and IO for ANET A6
February 04, 2021 04:26PM
Hi Everyone,
This is my first post on this forum. First of all, I would like to thank every contributor to the Marlin firmware! I have been a happy user for a while now, it was just the thing I needed, compared to the stock shipped firmware on my Anet A6.
I'm now ready to go into the deep end smiling smiley

I would like to try adding some extra IO to the Anet board (Atmega 1284p)
Any help/insight for the below would be appreciated.

The electronics/hardware part I've sorted:
By redirecting pins on the LCD header/plug and re-direct the Fan pin, I'm able to:
• Free up the uC pins for I2C and directly connect a 2nd Z-driver to the uC
• Add an MCP23017 IO board on I2C for inputs
• Add an PCA9685 PWM output board on I2C
• Redirect the Encoder/dial on the LCD to the MCP23017
• Redirect the Fan mosfet to be driven by the PCA9685
More details are on https://github.com/DutchForeigner/Anet-Z2-IO-Module

I've created a duplicate board of the ANET_10 board
• Added "#define BOARD_ANET_10_Z2_IO 1512" to boards.h
• Created "pins_ANET_10_Z2_IO.h" based on "pins_ANET_10.h"
• Added:
#elif MB(ANET_10_Z2_IO)
#include "sanguino/pins_ANET_10_Z2_IO.h"
to file "pins.h"

My questions are now:
1. How to assign pins on the I2C IO pins in the pins file (and have Marlin access those via I2C)?
   For example: the FAN will be on I2C PCA9685 port 15. Do I give that a virtual pin-number like 215 or IO2_15?
2. Where (which folder/include in which file) would I put the Arduino libraries for the PCA9685 & MCP23017?
3. In which part/file would I intercept the 'virtual' pin number/names from the pins file to route them via I2C?
4. Any change in input signals on the MCP23017 would generate an interrupt on D10. How/where would that need to be picked up?

I would be able to work my way through the C++ files etc.
If/when I manage to get this to work, I do plan to put all of it into a PR.
Sorry, only registered users may post in this forum.

Click here to login