Ethercat compatible Encoder board tentative STM32F4 + LAN9252

  • vibram
  • Away
  • Senior Member
  • Senior Member
More
10 Dec 2025 15:29 - 10 Dec 2025 16:03 #339947 by vibram
Hello,


With the help of @Hakan, I will try to make a SinCos encoder input ethercat compatible board.
I'm a beginner so please don't give credit to my post, this is a learning project.
chip used: STM32F407VE and LAN9252

Here is the git project: 
github.com/paulsvc/Firmware

Done:
Step 1: Quadrature Encoder input 

Ongoing:
Step 2: Ethernet layer

@Hakan, I struggle to setup the ethernet part. I use the following pins:
SPI2_MISO: PC2
SPI2_MOSI: PC3
SPI_IRQ: PA8
SPI2_SCK: PB10
SPI_NSS: PB8
SYNC0:PC6
SYNC1: PB15

I went through the EASERCAT7000 project but I'm not sure when do you setup these previous pins

Thank you in advance for your help
Last edit: 10 Dec 2025 16:03 by vibram.

Please Log in or Create an account to join the conversation.

More
10 Dec 2025 21:04 #339954 by Hakan
I am away from the code for at least one more day. I'll give you some clues for now and give a more precise answer when I am back.
You *must* set up spi. The other pins are set up as needed. Use free-run mode and you don't need them.

Spi is setup using stm32duino standard spi functions.
Somewhere in lib/soes c or h file (also check subdirectories to lib/soes) there is a call to
spi_begin(). Find that . Check there for pins, speed, and Chip Select. And set them to match your dev board.
Use slow speed to start with. Increase as it starts to work. I have on max now (80 MHz?), was on some kHz when troubleshooting.

Actually #if 0 all ethercat code and use the normal arduino setup(), loop() for encoder testing.
If you use serial port output it must be explicitly opened or something, check code.
You should be able to come a long way and then I'm back.
 
The following user(s) said Thank You: vibram

Please Log in or Create an account to join the conversation.

Time to create page: 0.051 seconds
Powered by Kunena Forum