new board definition mpconfigboard.h

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
Post Reply
User avatar
jgriessen
Posts: 114
Joined: Mon Sep 29, 2014 4:20 pm
Contact:

new board definition mpconfigboard.h

Post by jgriessen » Sat Dec 02, 2017 3:44 pm

OTG_FS_DM and OTG_FS_DP only show up in the ports/stm32/boards/stm32f401_af.csv file.

They are not present in any board definitions. Is there no way to ever change the USB pins used from defaults?

I see in the Alt Functions table there is no other set of pins the USB shows on, so I guess that is why.

Not having a 1 to 1 correspondence between lines in mpconfigboard.h and pins available in a MCU package makes
checking for correctness harder. Would it be OK to find the underlying lines similar to
#define MICROPY_HW_USB_OTG_ID_PIN (pin_A10)
and include them in mpconfigboard.h?

Lines about OTG_FS_DM, OTG_FS_DP, OTG_FS_SOF?

Where are they?

Also JTAG -- it only shows in the stm32f401_af.csv file, and then that name does not match what is in STM32 AF table.
When I grep for matches three seems to be disagreement between stm32f4xx_af.csv files on those names:

Code: Select all

john@toolbench64 [micropython]grep -r SWDIO
ports/stm32/boards/stm32f439_af.csv:PortA,PA13,JTMS-SWDIO,,,,,,,,,,,,,,,EVENTOUT,
ports/stm32/boards/stm32f411_af.csv:PortA,PA13,JTMS-SWDIO,,,,,,,,,,,,,,,EVENTOUT,
ports/stm32/boards/stm32f429_af.csv:PortA,PA13,JTMS-SWDIO,,,,,,,,,,,,,,,EVENTOUT,
ports/stm32/boards/stm32l476_af.csv:PortA,PA13,JTMS-SWDIO,IR_OUT,,,,,,,,,OTG_FS_NOE,,,,,EVENTOUT,,
ports/stm32/boards/stm32f746_af.csv:PortA,PA13,JTMS,SWDIO,,,,,,,,,,,,,,EVENTOUT
ports/stm32/boards/stm32f767_af.csv:PortA,PA13,JTMS,SWDIO,,,,,,,,,,,,,,EVENTOUT
ports/stm32/boards/stm32f401_af.csv:PortA,PA13,JTMS_SWDIO,,,,,,,,,,,,,,,EVENTOUT,
Some lines have two fields: JTMS,SWDIO
some have a dash: JTMS-SWDIO
The F401 file, tested on G30_TH platform has JTMS_SWDIO, which is same as in STM32 datasheet table 9 of AltFunctions -- AF.

Is this mismatching a mistake?

User avatar
dhylands
Posts: 2516
Joined: Mon Jan 06, 2014 6:08 pm
Location: Shuswap, BC, Canada
Contact:

Re: new board definition mpconfigboard.h

Post by dhylands » Sun Dec 03, 2017 5:29 am

The ones that are JTMS,SWDIO are probably correct. There are 2 signals here, JTMS for JTAG and SWDIO for SWD. The convention used in the _af.csv file is that if there are multiple distinct signals assigned to an alternate function then they should be separated by slashes. So the ones that use a dash or underscore should really be JTMS/SWDIO since JTMS is one signal, and SWDIO is another.

Currently, the script which generates pin definitions ignores JTMS and SWDIO so the fact that they're JTSM_SWDIO or JTMS-SWDIO is more or less inconsequential, but they really should be JTMS/SWDIO.

User avatar
jgriessen
Posts: 114
Joined: Mon Sep 29, 2014 4:20 pm
Contact:

Re: new board definition mpconfigboard.h

Post by jgriessen » Sun Dec 03, 2017 4:35 pm

The ones that are JTMS,SWDIO are probably correct.
It looks to me like the commas are about which AF is being chosen in one field, so going to two fields for a signal such as these that are in one field in the datasheet is probably wrong:

Datasheet spellings of AF0 column of table 9. Alternate function mapping:
JTMS_SWDIO, JTCK_SWCLK, JTDI, JTDO-SWO, JTRST

Currently, the script which generates pin definitions ignores JTMS and SWDIO
Then is nothing needed to use JTAG besides a stm.mem32 register write or three?

Can this be added to micropython board definitions easily now? Maybe now is the time to create a
MICROPY_HW_HAS_JTAG and a script jtag.c, and maybe a MICROPY_HW_HAS_SWD and a script swd.c

The ARM debug connector docs have different names than STM chose, and that is OK by me. I would just leave the names as in the STM datasheet and ref manual for F401.

User avatar
dhylands
Posts: 2516
Joined: Mon Jan 06, 2014 6:08 pm
Location: Shuswap, BC, Canada
Contact:

Re: new board definition mpconfigboard.h

Post by dhylands » Mon Dec 04, 2017 6:49 pm

I don't think that anything is required in order to use JTAG for basic debugging. Some code would need to be written if you were trying to support semi-hosting or something along those lines. But all of the debug functionality should work "out of the box".

User avatar
jgriessen
Posts: 114
Joined: Mon Sep 29, 2014 4:20 pm
Contact:

Re: new board definition mpconfigboard.h

Post by jgriessen » Sat Dec 09, 2017 10:28 pm

I don't think that anything is required in order to use JTAG for basic debugging.
I'm thinking of boundary scan tests.
More than the pins used for SWD.

Are pins PA13 JTMS_SWDIO, PA14 JTCK, PA15 JTDI, PB3 JTDO_SWO, PB4 NJTRST, all initialized?

Searching for clues shows:

grep -r JTMS

ports/stm32/boards/stm32f401_af.csv:PortA,PA13,JTMS_SWDIO,,,,,,,,,,,,,,,EVENTOUT,

Searching for lower case yields nothing and the other pin names show up only in the stm32f4xx_af.csv files. The real setup code must be in a library out of the micropython tree...

Post Reply