Page 1 of 2

Octopus Pro v1.0.1 board with Arduino

Posted: Thu May 05, 2022 6:31 pm
by brenda
Hi,

so I have this board, the Bigtreetech Octopus Pro v1.0.1., and I want to use it for a little different purpose than what it was made for.
I've already went through a little journey to get any code running on the board... I currently use Arduino IDE with the STM32duino library, board Generic STM32F4 Series, board part number Generic F429GTx.

With this setup, I've had success getting the Serial over USB working and also some accessory over I2C, but now I wanted to get the, or so I thought, the easiest part going, which are the steppers. Of course, as with everything else, it didn't go as planned. I've eventually discovered that I can't control many of the pins running to the stepper headers. Meaning that,

Code: Select all

digitalWrite(pin, HIGH/LOW)
does not work. For example, in the DRIVER1 header, I can only toggle the CS pin, which is (probably) PD11, all other pins on this header do nothing when accessed by digitalWrite().
I've also noticed that I can access the pins only by the defined name, like PA13 for the led, if I use the pin number, 105, nothing happens.
This leads me to the board variant.h definition, which I absolutely have no clue how works, with the pin name definitions having completely different pin numbers than what is in the MCU documentation and also the schematics from the board manufacturer.

Could someone explain to me what am I doing wrong or why do the board variants look like they do? I've run out of ideas on what to try next.

For anyone willing to help, here are some resources I've been using so far:

Board schematic https://github.com/bigtreetech/BIGTREET ... ctopus.pdf
It's not really for this board, but it's the only one that exists

Board layout https://raw.githubusercontent.com/bigtr ... pinout.png

MCU datasheet https://cz.mouser.com/datasheet/2/389/d ... 797623.pdf

Re: Octopus Pro v1.0.1 board with Arduino

Posted: Thu May 05, 2022 6:55 pm
by ag123
for these boards to verify the pins, it takes some indicator at the pin to see if it is working. e.g. a LED.
then you can do things like

Code: Select all

pinMode(PAxx, OUTPUT);
digitalWrite(PAXX, HIGH);
Or some such thing. The motor drivers aren't the easiest thing to interface. some use some kind of modified serial (uart) interface, e.g. the trinamic motor drivers.

oh and use the PAxx symbols, it saves you trying to figure out or remember pin maps.
the symbols almost always goes to the correct pin, even if the pin map is 'wrong', e.g. you can choose different variants for the same chip, as long as it is PAxx symbols, they still compile and works.

and there are all the rumentary things, make sure you have successfully blinked the led and talk to it via USB serial etc. with your sketch.
that is to be assured the crystal frequency and PLL system clocks are correctly setup.

Re: Octopus Pro v1.0.1 board with Arduino

Posted: Thu May 05, 2022 7:01 pm
by brenda
I am using a multimeter to check what the pin is doing. Even when using the Pxxx symbols, which are supposed to be the PF15, PG0, PG1 and PD11, only the PD11 does something, the others stay the same all the time

Re: Octopus Pro v1.0.1 board with Arduino

Posted: Thu May 05, 2022 7:03 pm
by ag123
there is another thing, firmwares like Marlin isn't quite the same as 'vanilla' stm32duino.
they may use their codes and drivers that is independent of stm32duino.

other things are to dig into the variant codes, see that those GPIO banks are clocked.
the 'basic' GPIO banks e.g. PAxx, PBxx, are most likely clocked.
The 'higher' banks Pyxx may not be clocked, digging into the variant codes would help figure it out.

Re: Octopus Pro v1.0.1 board with Arduino

Posted: Thu May 05, 2022 7:06 pm
by brenda
ag123 wrote: Thu May 05, 2022 7:03 pm there is another thing, firmwares like Marlin isn't quite the same as 'vanilla' stm32duino.
they may use their codes and drivers that is independent of stm32duino.
what do you mean with 'may use their codes and drivers'? I'm not using anything from the Marlin codebase, even the variant.h files are directly from smt32duino

Re: Octopus Pro v1.0.1 board with Arduino

Posted: Fri May 06, 2022 6:45 am
by ag123
my apologies, i'm off tracked.
out of curiosity i took a look at the schematics
https://github.com/bigtreetech/BIGTREET ... ctopus.pdf

it is using the stm32f446zet6
if you used the
F446Z(C-E)(H-J-T) variant
https://github.com/stm32duino/Arduino_C ... -E)(H-J-T)
the clocks actually aren't configured, it is using the internal HSI clock
https://github.com/stm32duino/Arduino_C ... ic_clock.c

i've found some other variants intended for other boards
https://github.com/stm32duino/Arduino_C ... 446V(C-E)T
i've found one with a HSE external clock setup
https://github.com/stm32duino/Arduino_C ... ETC_S6.cpp
this one seem to be configured for a 12 mhz crystal the dividers
m = 6, n = 180, p = 2 works out to 12 / 6 * 180 / 2 ~ 180 Mhz - system clock
just that it is for F446V which is a smaller series vs F446Z on your board. The clock setups are nevertheless similar

e..g copy that SystemClock_Config() from the fysetc_s6 board,
update your local copy for F446Z variant perhaps where the generic clock config is defined.
or better still make a new variant, this would require updating boards.txt

the pin map needs to be properly declared so that they are initialized (i.e. clocked)
https://github.com/stm32duino/Arduino_C ... eneric.cpp
you may like to review that, it seemed the generic variant pretty much takes care of it.
so what is missing is to create your SystemClock_Config() in the variant so that it runs on the external crystal HSE
then do the usual tests, blink a led on board, test that USB serial works as expected i.e. Serial.print() works, etc.

Re: Octopus Pro v1.0.1 board with Arduino

Posted: Fri May 06, 2022 7:52 am
by fpiSTM
I guess correct reference is STM32F429ZGT6.

About PD11 the pin number is simply the one define in the generic_variant.h:
https://github.com/stm32duino/Arduino_C ... eric.h#L77

So the below usage are the same:

Code: Select all

digitalWrite(PD11, High);
digitalWrite(59, High);
digitalWrite(D59, High);
Same for PA13. 105 is the package pin number and have no link with the one define in the variant. It is only a pin mapping.
Simply use the alias PYn and you will have no issue.

In our case PA13 is 13 or D13:
https://github.com/stm32duino/Arduino_C ... eric.h#L31

Without the correct schematics it is hard to help. The one provided is for F446. You can try to compare both and write an equivalence table.

Re: Octopus Pro v1.0.1 board with Arduino

Posted: Fri May 06, 2022 9:04 am
by brenda
ag123 wrote: Fri May 06, 2022 6:45 am my apologies, i'm off tracked.
out of curiosity i took a look at the schematics
https://github.com/bigtreetech/BIGTREET ... ctopus.pdf

it is using the stm32f446zet6
Sry I didn't mention it clearly in my first post. I'm running the STM32F429ZGT6. There is no schematic for this board with this MCU.

I've mentioned that Serial and I2C works, the LED on PA13 works, so the configuration I'm using is probably correct, but I suspect the pin mapping is not.

Re: Octopus Pro v1.0.1 board with Arduino

Posted: Fri May 06, 2022 9:13 am
by brenda
fpiSTM wrote: Fri May 06, 2022 7:52 am Without the correct schematics it is hard to help. The one provided is for F446. You can try to compare both and write an equivalence table.
Yeah, without the correct schematic...
Can you advise on how to find out where the pins are actually going to? Can I just probe them all from the MCU pins to the headers to find out which is which? It now really seem that the schematic is completely different from the V1.0. one, at least for the DRIVER headers, since there are some pins that are correct and I can control them, like the LED, I2C header or HardwareSerial

Re: Octopus Pro v1.0.1 board with Arduino

Posted: Sat May 07, 2022 11:42 am
by brenda
So through mindlessly probing the board I've find out that the driver headers are not directly connected to the MCU, but via a HCT125 Bus Buffer Gates, this explains why I wasn't able to toggle some header pins directly, the buffer outputs need to be toggled first. These chips are not mentioned once is the schematic