Skip to content
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

AP_HAL_ChibiOS: Add support for STM32F413xx #28845

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

joshanne
Copy link
Contributor

@joshanne joshanne commented Dec 12, 2024

Generated the STM32F413xx python module from datasheet (stm32f413cg) and reference manual (rm0430-stm32f413423-advanced-armbased-32bit-mcus-stmicroelectronics).

Added changes for supporting STM32F413xx to mcuconf.

Generated the STM32F413xx script from reference manuals and datasheets
Added changes for supporting STM32F413 to mcuconf
@joshanne joshanne requested a review from tridge December 12, 2024 00:19
@joshanne joshanne changed the title AP_HAL_ChibiOS: Add STM32F413xx module AP_HAL_ChibiOS: Add support for STM32F413xx Dec 12, 2024
@joshanne
Copy link
Contributor Author

joshanne commented Dec 12, 2024

We are using a board with an STM32F413 - Best I can see, there have been requests (issue#8832) and attempts to add support for STM32F413xx in the past, but appears the MCU definition has never been added.

I've used the Ref Man and datasheet to pull out the CSV required to run the parser scripts.

We have a build running on the F413, seemingly without issues.

I'd be keen for a backport to periph stable if it makes sense to do so - though I've not built with this on stable yet.

fails because of iterator not returning strings and 'dict' object has no attribute 'iterkeys'. Fixed so both scripts run.
@joshanne joshanne force-pushed the pr/add-support-for-STM32F413xx branch from 1b26522 to 2c3467c Compare December 13, 2024 03:09
Copy link
Collaborator

@andyp1per andyp1per left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you remove the drive-by's this looks correct to me and safe to go in

@@ -28,7 +28,7 @@ def is_pin(str):
return False

def parse_adc_table(fname, table):
csvt = csv.reader(open(fname,'rb'))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should remove this drive-by

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't consider this to be drive by given the script doesn't run without the change, and you can't generate the table without the script.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah apologies, did not realise that was what it was for

@@ -86,10 +86,10 @@ def parse_af_table(fname, table):

parse_af_table(sys.argv[1], table)

sys.stdout.write("AltFunction_map = {\n");
sys.stdout.write("AltFunction_map = {\n")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

sys.stdout.write('\t# format is PIN:FUNCTION : AFNUM\n')
sys.stdout.write('\t# extracted from %s\n' % os.path.basename(sys.argv[1]))
for k in sorted(table.keys(), key=cmp_to_key(pin_compare)):
s = '"' + k + '"'
sys.stdout.write('\t%-20s\t:\t%s,\n' % (s, table[k]))
sys.stdout.write("}\n");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@@ -11,7 +11,7 @@

def parse_dma_table(fname, table):
dma_num = 1
csvt = csv.reader(open(fname,'rb'))
csvt = csv.reader(open(fname,'r'))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@@ -78,7 +78,7 @@ def check_full_table(table):
sys.stdout.write('\t# format is (DMA_TABLE, StreamNum, Channel)\n')
sys.stdout.write('\t# extracted from %s\n' % os.path.basename(sys.argv[1]))

for k in sorted(table.iterkeys()):
for k in sorted(table.keys()):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

"I2S3_EXT_RX" : [(1,2,2),(1,0,3)],
"I2S3_EXT_TX" : [(1,5,2)],
"QUADSPI" : [(2,7,3)],
"SAI1B" : [(2,4,1)],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reference manual calls this out separately to SAI1_B - I suspect this is a typo, I'll fix this up when I have a moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants