Serial on Mikromedia Plus STM32
Posted: Sun Jun 12, 2016 10:12 pm
Hi,
I am using a Mikromedia Plus for STM32. I managed to get two LED's to blink using ChibiOS. The timing is correct
I have been trying to get the serial driver working on it by adapting the demo code for STM32F4 discovery but it's not working.
(I have tested the HAl test code on the Discovery board and know that it is working)
Here is the (non-working) UART code I have right now adapted from Mikromedia board.h files :
sdStart(&SD2, NULL);
palSetPadMode(GPIOC, GPIOC_HDR_UART2_TX, PAL_MODE_ALTERNATE(8));
palSetPadMode(GPIOC, GPIOC_HDR_UART2_RX, PAL_MODE_ALTERNATE(8));
chprintf((BaseSequentialStream *)&SD2, "SYSCLK=%u\r\n", STM32_SYSCLK);
A couple of questions:
1) Do I have to write the linker scipt myself for this new chip or does ChibiOS takes care of the various STM32 families.
2) The only difference I see apart from the pin changes is that this board uses an STM32F407ZG clocked from
a 25Mhz running at 150Mhz (HSS+PLL) while the STM32F4 discovery runs at 168MHz using an 8MHz clock.
How would I change the Serial driver clock from the ChibiOS API.
Here are the current clock settings. I cannot use the USB serial since it complains about the 48Mhz clock.
#define STM32_NO_INIT FALSE
#define STM32_HSI_ENABLED TRUE
#define STM32_LSI_ENABLED TRUE
#define STM32_HSE_ENABLED TRUE
#define STM32_LSE_ENABLED TRUE
#define STM32_CLOCK48_REQUIRED TRUE
#define STM32_SW STM32_SW_PLL
#define STM32_PLLSRC STM32_PLLSRC_HSE
#define STM32_PLLM_VALUE 16
#define STM32_PLLN_VALUE 192
#define STM32_PLLP_VALUE 2
#define STM32_PLLQ_VALUE 6
#define STM32_HPRE STM32_HPRE_DIV1
#define STM32_PPRE1 STM32_PPRE1_DIV4
#define STM32_PPRE2 STM32_PPRE2_DIV2
#define STM32_RTCSEL STM32_RTCSEL_LSE
#define STM32_RTCPRE_VALUE 8
#define STM32_MCO1SEL STM32_MCO1SEL_PLL
#define STM32_MCO1PRE STM32_MCO1PRE_DIV3
#define STM32_MCO2SEL STM32_MCO2SEL_SYSCLK
#define STM32_MCO2PRE STM32_MCO2PRE_DIV1
#define STM32_I2SSRC STM32_I2SSRC_CKIN
#define STM32_PLLI2SN_VALUE 192
#define STM32_PLLI2SR_VALUE 5
#define STM32_PVD_ENABLE FALSE
#define STM32_PLS STM32_PLS_LEV0
#define STM32_BKPRAM_ENABLE FALSE
Any pointers would be appreciated.
Demeter
I am using a Mikromedia Plus for STM32. I managed to get two LED's to blink using ChibiOS. The timing is correct
I have been trying to get the serial driver working on it by adapting the demo code for STM32F4 discovery but it's not working.
(I have tested the HAl test code on the Discovery board and know that it is working)
Here is the (non-working) UART code I have right now adapted from Mikromedia board.h files :
sdStart(&SD2, NULL);
palSetPadMode(GPIOC, GPIOC_HDR_UART2_TX, PAL_MODE_ALTERNATE(8));
palSetPadMode(GPIOC, GPIOC_HDR_UART2_RX, PAL_MODE_ALTERNATE(8));
chprintf((BaseSequentialStream *)&SD2, "SYSCLK=%u\r\n", STM32_SYSCLK);
A couple of questions:
1) Do I have to write the linker scipt myself for this new chip or does ChibiOS takes care of the various STM32 families.
2) The only difference I see apart from the pin changes is that this board uses an STM32F407ZG clocked from
a 25Mhz running at 150Mhz (HSS+PLL) while the STM32F4 discovery runs at 168MHz using an 8MHz clock.
How would I change the Serial driver clock from the ChibiOS API.
Here are the current clock settings. I cannot use the USB serial since it complains about the 48Mhz clock.
#define STM32_NO_INIT FALSE
#define STM32_HSI_ENABLED TRUE
#define STM32_LSI_ENABLED TRUE
#define STM32_HSE_ENABLED TRUE
#define STM32_LSE_ENABLED TRUE
#define STM32_CLOCK48_REQUIRED TRUE
#define STM32_SW STM32_SW_PLL
#define STM32_PLLSRC STM32_PLLSRC_HSE
#define STM32_PLLM_VALUE 16
#define STM32_PLLN_VALUE 192
#define STM32_PLLP_VALUE 2
#define STM32_PLLQ_VALUE 6
#define STM32_HPRE STM32_HPRE_DIV1
#define STM32_PPRE1 STM32_PPRE1_DIV4
#define STM32_PPRE2 STM32_PPRE2_DIV2
#define STM32_RTCSEL STM32_RTCSEL_LSE
#define STM32_RTCPRE_VALUE 8
#define STM32_MCO1SEL STM32_MCO1SEL_PLL
#define STM32_MCO1PRE STM32_MCO1PRE_DIV3
#define STM32_MCO2SEL STM32_MCO2SEL_SYSCLK
#define STM32_MCO2PRE STM32_MCO2PRE_DIV1
#define STM32_I2SSRC STM32_I2SSRC_CKIN
#define STM32_PLLI2SN_VALUE 192
#define STM32_PLLI2SR_VALUE 5
#define STM32_PVD_ENABLE FALSE
#define STM32_PLS STM32_PLS_LEV0
#define STM32_BKPRAM_ENABLE FALSE
Any pointers would be appreciated.
Demeter