Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I2C IO? #6

Open
ShadeTechnik opened this issue Mar 28, 2024 · 9 comments
Open

I2C IO? #6

ShadeTechnik opened this issue Mar 28, 2024 · 9 comments

Comments

@ShadeTechnik
Copy link

Came across this whole project as I was actually in the middle of working on almost the exact same thing, then realized I wasn't the first one to have the idea which is good cuz I can't code to save my life lol.

Anyway once I get finished with my PCB I hope to be able to use this code. One thing I was curious about is if you thought about adding support for I2C IO expanders. I created a keypad a little while ago that has 4 MCP23017's that I'm eventually going to have to work into my project.....but like I said, I don't do code lol.

@MetalMusings
Copy link
Owner

MetalMusings commented Mar 29, 2024 via email

@ShadeTechnik
Copy link
Author

Yeah it'll be a bit of a chore for me to get it going but I've got a friend that can hopefully help me out.

The PCB isn't really a concern, I'm just EtherCAT-izing an existing PCB. The one I'm currently working on is a bit more simple, it's for a control panel so it doesn't need the stepgens. From what I'm looking at so far (please correct me if I'm wrong) you used the timer based encoder peripherals. I need like 4 encoders, but much lower performance. The timer peripherals cause conflicts with other peripherals so I was just going to use an interrupt based encoder library.

Once I get this sorted out and working maybe I'll do something for higher performance encoders and stepgens, this one's hopefully going to solve some other issues I had and just get me into the world of EtherCAT. Do you have an email or some way to contact in case I have questions if you don't mind?

@MetalMusings
Copy link
Owner

MetalMusings commented Mar 30, 2024 via email

@ShadeTechnik
Copy link
Author

I'm actually using a smaller STM32 than you did, mine is just for a control panel and I'm using some of the GPIO from the LAN5952. I use STM32cubeIDE to check the peripherals for conflicts. I was only able to squeeze 1 timer based encoder out but that'll just be for an MPG, the others will be for like feedrate OR knobs and such so they don't demand any performance. I was able to get them all on interrupt lines without issue.

I think I managed to get my code wizard friend involved, I've asked him set me up a repo with the code arranged in a more idiotproof manner so hopefully I can follow it well enough to make necessary adjustments. He's not a machine/ethercat guy but he does do embedded programming.

I know you didn't really mention a reason for switching ESC chips but did you have some problem with the LAN9252? It's readily available and has what I need so it seems like my best bet, just curious if there's some reason I should not use it.

LAN5952 does have a nRST line. I'm debating tying it to the STM32 nRST and running them both to the same reset button.

@MetalMusings
Copy link
Owner

MetalMusings commented Mar 31, 2024 via email

@ShadeTechnik
Copy link
Author

You can't mix digital IO from the LAN9252 with MCU access using SPI. It's either or. Check PDI MODE SELECTION, first byte in the eeprom.

This I wasn't sure about. I initially thought this but the illustration on page 10 of the the datasheet suggests this is possible "Microcontroller Mode (via SPI)" appears to show the GPIOs being active. I could not find anything that states it either way definitively but from what I gathered the GPIOs are disabled using parallel HBI or "expansion mode" as those 2 modes used the GPIO pins for either host communication or the 3rd Ethernet port. Have you actually tested this?

I haven't picked up a LAN9252 dev board to test, it's actually easier for me to just produce a prototype PCB and tinker with that so I can't test it but it would be nice to be certain that you can't do this before I bother.

@MetalMusings
Copy link
Owner

MetalMusings commented Apr 1, 2024 via email

@ShadeTechnik
Copy link
Author

Well I'm hoping my friend can sort most of that out, what I have found in the datasheet:

12.5 Host Interface PDI
The value in the Extended PDI Configuration Register is used if GPIOs are enabled (SPI w/GPIO).

12.14.30 EXTENDED PDI CONFIGURATION REGISTER
The bit definitions of this register are dependent on the selected PDI mode (Process Data Interface field in the PDI Control Register): Digital I/O Mode or SPI Mode.

@MetalMusings
Copy link
Owner

MetalMusings commented Apr 2, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants