-
Notifications
You must be signed in to change notification settings - Fork 1k
Support for elecgator EtherCATduino board #1414
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
Conversation
Hi @pieterjanbuntinx |
variants/STM32F7xx/F745Z(E-G)T_F746Z(E-G)(T-Y)_F750Z8T_F756ZG(T-Y)/variant_ETHERCAT_DUINO.cpp
Outdated
Show resolved
Hide resolved
variants/STM32F7xx/F745Z(E-G)T_F746Z(E-G)(T-Y)_F750Z8T_F756ZG(T-Y)/variant_ETHERCAT_DUINO.cpp
Outdated
Show resolved
Hide resolved
variants/STM32F7xx/F745Z(E-G)T_F746Z(E-G)(T-Y)_F750Z8T_F756ZG(T-Y)/variant_ETHERCAT_DUINO.cpp
Outdated
Show resolved
Hide resolved
variants/STM32F7xx/F745Z(E-G)T_F746Z(E-G)(T-Y)_F750Z8T_F756ZG(T-Y)/variant_ETHERCAT_DUINO.cpp
Outdated
Show resolved
Hide resolved
variants/STM32F7xx/F745Z(E-G)T_F746Z(E-G)(T-Y)_F750Z8T_F756ZG(T-Y)/variant_ETHERCAT_DUINO.cpp
Outdated
Show resolved
Hide resolved
Hey @fpistm |
OK. for the ESC as no documentation is available at this time hard to check 😉 Then you can call it from repo root path like this (specify the path to check instead of checking the full repo): |
variants/STM32F7xx/F745Z(E-G)T_F746Z(E-G)(T-Y)_F750Z8T_F756ZG(T-Y)/variant_ETHERCAT_DUINO.cpp
Outdated
Show resolved
Hide resolved
variants/STM32F7xx/F745Z(E-G)T_F746Z(E-G)(T-Y)_F750Z8T_F756ZG(T-Y)/variant_ETHERCAT_DUINO.cpp
Show resolved
Hide resolved
variants/STM32F7xx/F745Z(E-G)T_F746Z(E-G)(T-Y)_F750Z8T_F756ZG(T-Y)/variant_ETHERCAT_DUINO.cpp
Show resolved
Hide resolved
variants/STM32F7xx/F745Z(E-G)T_F746Z(E-G)(T-Y)_F750Z8T_F756ZG(T-Y)/variant_ETHERCAT_DUINO.cpp
Show resolved
Hide resolved
variants/STM32F7xx/F745Z(E-G)T_F746Z(E-G)(T-Y)_F750Z8T_F756ZG(T-Y)/variant_ETHERCAT_DUINO.cpp
Show resolved
Hide resolved
variants/STM32F7xx/F745Z(E-G)T_F746Z(E-G)(T-Y)_F750Z8T_F756ZG(T-Y)/variant_ETHERCAT_DUINO.h
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made a deeper review and found several issue.
I've made a branch on my fork:
https://github.com/fpistm/Arduino_Core_STM32/tree/pr-1414-ethercatduino-review
- This PR has been rebased and squashed on top of the master
- Fix Analog pin definition
(only 3 defined in the variant.h have the Ax capabilities) - Comment DAC as no pin defined
- Add USB pin definition (PA11/PA12)
- Add link to the board section in the README.md
- Reorder boards.txt (alphabetical order for manufacturer)
- Remove node definition
- Add custom peripheral pins as not all pins available and allow to save space
- All pins not defined in the variant.h has been commented
- Comment some extra pins or HAL module definition
as not all pins available for the same peripheral instance
Ex: No QSPI CLK defined or SDMMC CMD or ETH_REF_CLK - Fixed system core clock config
About analog pin, I saw that it should be 12 so you have to defined in the variant.h all the pins which can be used. Same for ethernet (I guess you need Ethernet?)
About the clock config, you probably test it before adding the Error_handler()
?
The value used set the freq at 675 MHz because the default HSE_VALUE
is 25 MHz.
I guess you have a 8MHz ? In that case HSE_VALUE
have to be defined in the variant_ETHERCAT_DUINO.h
#define HSE_VALUE 8000000
My update are based on the variant.h definition. With a schematics or documentation it is easier to properly review it.
Hi @fpistm, Thank you for the review! (please ignore the accidental closing and reopening of this PR, I'm kind of a Github noob)
|
Thanks @pieterjanbuntinx |
@fpistm , the HSE value is 8 MHz. I see I then may have merged a little too much from your modifications. I'm going to test all of this thoroughly with my board and I'll get back to you on this. |
So you have to add this in the variant header: |
Hi @fpistm, How can I properly override the SystemClock_Config() function in my library? I tried copy+pasting my initial systemclock_config function to the library and calling it in the init function but that doesn't seem to apply everything. I have to change these two:
in SystemClock_config in the variant.cpp file back to respectively 4 and 216 to make the USB serial work again. I also have to define the following in the variant.h file to get my QSPI for the EtherCAT chip working:
Copying the same lines into my main library file doesn't seem to work. In hal_conf.custom.h |
@pieterjanbuntinx Same for the QSPI enable it by default in the variant. I don't think the I will review this PR and add proper config. |
@fpistm |
What are the pins used by the QSPI and the Ethernet? Seems they are not defined? |
Ethernet of the STM32 chip is not used, the Ethernet jacks are driven by an external controller that is interfaced using QSPI. The QSPI pins are configured internally in the library using the STM32 method instead of Arduino's. No, we don't use SD |
OK it is clear, anyway some SQPI pins are not defined, mainly PB2 for the clock so probably other one are not defined. |
I'll add all the pin definitions used to communicate with EtherCAT chip |
OK. |
I have now added all the used pins definitions of the EtherCAT controller. I have also reverted the PLLM and PLLN values. Otherwise USB virtual serial won't work. |
Thanks @pieterjanbuntinx |
@pieterjanbuntinx I also can push my branch on your fork and replace your branch if it is more simple for you? |
Hi @fpistm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your merge has some side effect, you have reverted last commits of the original repo (as your master was not synced).
- One pins ordering issue.
variants/STM32F7xx/F745Z(E-G)T_F746Z(E-G)(T-Y)_F750Z8T_F756ZG(T-Y)/variant_ETHERCAT_DUINO.cpp
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Great! Thanks for approving and all your help! |
FYI, when you create a PR by default you allow maintainers to edit. This means you allow me to push on your master branch as you used this branch for the PR. That's why I always advice to create a dedicated branch for PR to avoid master edition on your fork. Note that you created some tags on your master "1" and "2.0.1". They are always present. |
Welcome, anyway it would be good you do a final tests session to avoid any issue. Rerun check variant and stuff you consider useful to validate your board (USB, Serial, I2C, SPI,...) When done let me know if all is OK then we could merge. |
Okay, I'll try to think of that next time I do a PR. I've given you access now.
At the moment I'm busy doing that, I will let you know if everything works. |
Thanks but no need to invite me. It is a feature of the PR mechanism 😉 |
Is this OK? |
Hey @fpistm All pins work perfectly as digital input or output and A0 to A12 also work perfectly as Analog inputs. I've attached a pin diagram I have created for our board. |
There is no link between AF (Alternate Function) and the ALTx pins which stands for alternate pins for a peripheral. For the ALTx usage, an example is if you want to use About the DAC it is managed by default when you used the |
Hey @fpistm,
That's the way I started doing it. I was just experimenting to try and get it to work. Currently the following works correctly: I2C4 (PD12 PD13), I2C1 (PB8 PB9), UART6 (PC6 PC7), UART6 (PG9, PG14), UART4 (PC10, PC11), UART3 (PC10, PC11), UART2 (PA2, PA3), UART4 (PA0, PA1), all analog pins except the 4 listed below, all digital inputs/outputs. I've tried this on multiple boards so hardware failure seems unlikely. I've done most testing on PlatformIO but I've now also tried most of the testing in the Arduino IDE by flashing over DFU. |
@pieterjanbuntinx About your issue with the pins I have no clue for you. This is generic and know to work. |
@fpistm sorry, I shouldn't have done that. I've seen you have reverted it. I'll try to see with the debugger if the registers get correctly set. Have you had anything similar to this before? |
Don't know how you managed your branch but you loose some commit from the master. |
Signed-off-by: pjbuntinx2 <pieterjan@elecgator.com> Co-authored-by: Frederic Pillon <frederic.pillon@st.com>
I've fix the astyle issue.
No, I've tested the Nucleo F746 and this is fine. |
Just to confirm, I've retest with the Nucleo F746ZG:
About this: UART1 (only tx broken out -> PA9) |
Hey @fpistm, |
Hey @fpistm, |
@pieterjanbuntinx |
Yes, for me it's ready to be merged :) |
variants/STM32F7xx/F745Z(E-G)T_F746Z(E-G)(T-Y)_F750Z8T_F756ZG(T-Y)/variant_ETHERCAT_DUINO.h
Outdated
Show resolved
Hide resolved
variants/STM32F7xx/F745Z(E-G)T_F746Z(E-G)(T-Y)_F750Z8T_F756ZG(T-Y)/variant_ETHERCAT_DUINO.h
Outdated
Show resolved
Hide resolved
variants/STM32F7xx/F745Z(E-G)T_F746Z(E-G)(T-Y)_F750Z8T_F756ZG(T-Y)/variant_ETHERCAT_DUINO.h
Outdated
Show resolved
Hide resolved
variants/STM32F7xx/F745Z(E-G)T_F746Z(E-G)(T-Y)_F750Z8T_F756ZG(T-Y)/variant_ETHERCAT_DUINO.h
Outdated
Show resolved
Hide resolved
…T-Y)/variant_ETHERCAT_DUINO.h Co-authored-by: Frederic Pillon <frederic.pillon@st.com>
…T-Y)/variant_ETHERCAT_DUINO.h Co-authored-by: Frederic Pillon <frederic.pillon@st.com>
…T-Y)/variant_ETHERCAT_DUINO.h Co-authored-by: Frederic Pillon <frederic.pillon@st.com>
…T-Y)/variant_ETHERCAT_DUINO.h Co-authored-by: Frederic Pillon <frederic.pillon@st.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Summary
This PR adds support for the elecgator EtherCATduino board. This board is based on a STM32F746ZET microcontroller and uses a LAN9252 chip as the 2-port EtherCAT device controller (ESC). It has a built-in DC-DC that supports voltages from 7 to 28 Volts, a MicroUSB port, 2 RJ45 connectors, and the same pinout and overall form factor as an Arduino Mega. We are also in the process of creating a library for using the EtherCAT supported on this board.
This PR fixes/implements the following features
Validation