Page 1 of 1

ST_STM32F746G_DISCOVERY/board.h has ARD_D5 and ARD_D10 swapped?

Posted: Tue Apr 28, 2020 7:36 am
by wpaul

This is a little confusing so please bear with me.

I have an ST Micro STM32F746G Discovery reference board and I'm running it with ChibiOS 19.1.3. This board has a set of Arduino style headers on the back, and I recently added an mBED SX1262MB2CAS shield to it:

If you scroll down the page a little and look at the Pinout diagram, you can see that it has pin DIO1 connected to the ARD_D5 pin on the Arduino shield interface. This is the pin that the radio uses to signal interrupts.

I'm writing some driver code of my own for this radio, and so far I've been making OK progress, but I got a little stuck with the interrupt handling. I set up my code to try and use LINE_ARD_D5, but even though I was able to get the transmitter to send a packet, and see that the "TX done" interrupt bit was set in the IRQ register, my interrupt service routine was never triggering.

If you go to the following page, you can see the documentation for the STMF32F746G Discovery board: ... l#resource

Near the bottom in the SCHEMATICS section, there are two files available. One is for the MB1191 rev B02 board, while the other is for the MB1191 rev C01 board.

My board has a sticker on it that says: MB1191 B-04. (Actually I have two, they both say the same thing.)

Here's the confusing part:

If you look at the schematics for the Arduino connector in the rev B02 PDF, it shows that ARD_D5 is connected to GPIO port A pin 8 and ARD_D10 is connected to GPIO port I pin 0.

But in the rev C02 PDF, these pins are the other way around (ARD_D5 is GPIO port I pin 0, ARD_D10 is GPIO port A pin 8).

On my board (rev B04?) board, the ARD_D5 and ARD_D10 pins match the rev C02 schematic, not the rev B02 schematic.

Furthermore, there is a user's guide for the board, which is here: ... ronics.pdf

On page 23 of this manual there is a table for the Arduino connector which also agrees with my board and the rev C02 schematics.

Meanwhile, the board.h file in the ChibiOS STM32F746G Discovery BSP says:

Code: Select all

#define LINE_ARD_D5                 PAL_LINE(GPIOA, 8U)

#define LINE_ARD_D10                PAL_LINE(GPIOI, 0U)

Indeed, once I changed my driver code to use LINE_ARD_D10 instead of LINE_ARD_D5, my interrupt service routine started working as expected.

I don't know if this means that there actually was a rev B02 board where the pins were the other way around, or if the ARD_D5 and ARD_D10 definitions for these pins in the rev B02 schematic file were reversed by mistake. In any case, there does appear to be an unfortunate discrepancy between the current ChibiOS configuration and the currently available boards. (I bought mine just last year from Mouser Electronics.) I'm not sure what the right thing is to do about this, but I figured I should bring it to your attention. ChibiOS runs great on the board otherwise.


Re: ST_STM32F746G_DISCOVERY/board.h has ARD_D5 and ARD_D10 swapped?

Posted: Wed Apr 29, 2020 10:18 am
by RoccoMarco
I'll take a look into this.

Re: ST_STM32F746G_DISCOVERY/board.h has ARD_D5 and ARD_D10 swapped?

Posted: Wed Apr 29, 2020 11:00 am
by RoccoMarco
It seems the two pin have been swapped starting from revision C of the board.

Re: ST_STM32F746G_DISCOVERY/board.h has ARD_D5 and ARD_D10 swapped?

Posted: Wed Apr 29, 2020 8:54 pm
by wpaul
After closer examination, I'm fairly well convinced the problem is that there is an error in the "rev B02" schematics which has been propagated into ChibiOS.

For reference, here are some photos of the board I have:



It certainly seems to be rev B, and the sticker on the back implies it's rev B-04. The implication is it's newer than rev B02 but older than rev C01.

But, look again at the rev B02 schematics: ... ematic.pdf

Search for the string "ARD_D5" in the pdf.

On page 9, it shows all the connections to the CPU. On the lower right, you can see ARD_D5 is wired to pin PI0.

But on page 6, where it shows the layout of the Arduino headers, it instead says that ARD_D5 is wired to PA8.

You can also see the same reversal if you search for "ARD_D10."

I can tell you for a fact that on my board, the ARD_D5 pin is most definitely connected to PI0

So it must be the case that the diagram on page 6 is wrong: it has D5 and D10 swapped. The assignments on page 9 are correct. (And they fixed the mistake in the rev C schematics.)

Unfortunately ChibiOS is using the incorrect info from page 6. :(


Re: ST_STM32F746G_DISCOVERY/board.h has ARD_D5 and ARD_D10 swapped?

Posted: Wed Apr 29, 2020 8:56 pm
by Giovanni
OK, I'll swap the definitions. Owners of older boards will have to adjust.


Re: ST_STM32F746G_DISCOVERY/board.h has ARD_D5 and ARD_D10 swapped?

Posted: Thu Apr 30, 2020 1:07 am
by wpaul
Er... just to be clear, it's not an issue of old board vs. new. All the boards are actually wired the same. It's just that the older documentation had an error in it.

It might be an issue for anyone that has written code for ChibiOS using the older BSP -- they might have to upgrade their code to use the correct macros now.

But I have a feeling this won't be a serious problem because if anyone else had tried using these pins/macros before, they would have found they didn't work and would have said something before I did. :)


Re: ST_STM32F746G_DISCOVERY/board.h has ARD_D5 and ARD_D10 swapped?  Topic is solved

Posted: Thu Apr 30, 2020 3:20 pm
by RoccoMarco
Updated on trunk,
will be released in ChibiOS 20.3.1