Page 3 of 5
Re: STM32F3 ports
Posted: Fri Feb 08, 2019 8:35 pm
by romeo
Hi,
Ok the error now is that the MCU is unsupported!
Got into the mpconfigboard_common.h and I saw that mine is not supported.
These variables are missing:
Code: Select all
MP_HAL_UNIQUE_ID_ADDRESS
PYB_EXTI_NUM_VECTORS
MICROPY_HW_MAX_TIMER
MICROPY_HW_MAX_UART
Any hints?
Thanks,
Romeo
Re: STM32F3 ports
Posted: Sat Feb 09, 2019 4:48 am
by dhylands
Those should all be available from the data sheet and/or reference manual.
Re: STM32F3 ports
Posted: Sat Feb 09, 2019 8:59 am
by romeo
Hi!
I have updated the mpconfigboard_common.h with the data found in the reference manual.
Now I got stuck here:
- 20190209.PNG (23.05 KiB) Viewed 5868 times
Thanks,
Romeo
Re: STM32F3 ports
Posted: Sat Feb 09, 2019 3:34 pm
by dhylands
The problem in main.c is that the code wants a way to interact with the user for doing the various resets.
MICROPY_HS_HAS_SWITCH is defined, however it seems that neither MICROPY_HW_LED2 nor MICROPY_HW_LED1 is defined.
Looking at the mpconfigboard.h file I see lots of LEDs defined. I'm assuming that you chose LED numbers that match what's on the board. The micropython code wants LED1 thru N. I'd probably create definitions for 1 and 2 which map onto 2 of the other LEDs.
The other problem appears to be a bug in the make-pins.py script. As a temporary workaround, you can comment out these 2 lines:
https://github.com/sfynxu/stm32f3discov ... ins.py#L20
https://github.com/sfynxu/stm32f3discov ... ins.py#L30
I'll see what needs to be changed so that make-pins.py works for the F3.
Re: STM32F3 ports
Posted: Sat Feb 09, 2019 4:05 pm
by romeo
Hi,
Thank you. I came around with CAN by naming it CAN1 (since is the only one).
For LED I doubled the LED3 and named it LED2.
On the board LED1 and 2 are attached to ST-LINK programmer.
Now seems to be and error of dma, flash, ... and I stoped the script to get the screenshot.
I updated the repository also.
- 20190209_02.PNG (4.87 KiB) Viewed 5857 times
Thanks,
Romeo
Re: STM32F3 ports
Posted: Sat Feb 09, 2019 4:24 pm
by dhylands
The following change will fix make-pins.py to work properly with the F3. Change the function condition_var (line 58) from this:
Code: Select all
def conditional_var(name_num):
# Try the specific instance first. For example, if name_num is UART4_RX
# then try UART4 first, and then try UART second.
name, num = split_name_num(name_num)
var = []
if name in CONDITIONAL_VAR:
var.append(CONDITIONAL_VAR[name].format(num=num))
if name_num in CONDITIONAL_VAR:
var.append(CONDITIONAL_VAR[name_num])
return var
to this:
Code: Select all
def conditional_var(name_num):
# Try the specific instance first. For example, if name_num is UART4_RX
# then try UART4 first, and then try UART second.
name, num = split_name_num(name_num)
var = []
if num is None:
# Covers the case where name_num is CAN instead of CAN1
if name in CONDITIONAL_VAR:
var.append(CONDITIONAL_VAR[name].format(num=''))
else:
if name in CONDITIONAL_VAR:
var.append(CONDITIONAL_VAR[name].format(num=num))
if name_num in CONDITIONAL_VAR:
var.append(CONDITIONAL_VAR[name_num])
return var
The issue is that the F3 only has a single CAN peripheral, so the pins are named CAN_TX but the script was expecting CAN1_TX.
Re: STM32F3 ports
Posted: Sat Feb 09, 2019 4:38 pm
by romeo
Ok. Applied patch. Returned to old _af csv (with CAN, not CAN1).
Updated repository.
Can't figure out if F3 has DMA_Stream or DMA_Channel ...
Re: STM32F3 ports
Posted: Sat Feb 09, 2019 4:44 pm
by dhylands
A quick grep in the HAL directory shows lots of references to DMA_Channel_TypeDef and none to DMA_StreamTypeDef
Re: STM32F3 ports
Posted: Sat Feb 09, 2019 4:50 pm
by romeo
Ok. It seems legit.
I try this with the flash.c flashdev.c ... also
Thanks for the tip,
Romeo
Re: STM32F3 ports
Posted: Sun Feb 10, 2019 8:04 pm
by romeo
Hi!
Just finished the dac and adc!
The only thing I cannot figure out where to set the cache and how big should be ...
The rest is updated on github.
Any suggestion for the cache?
Thanks,
Romeo