I don't know, just try. If it compiles most likely it will work.
Giovanni
stm32lib - where do I get it from
Moderator: RoccoMarco
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: stm32lib - where do I get it from
Thanks Giovanni,
I tried to use the system call but there seemed to be some conflict in GPIO_TypeDef.
Currently I'm trying to control the LCD board on top of stm32l-discovery. To avoid the compile error I encountered, I decided to use the GPIO_TypeDef under pal_lld.h, and change the code in LCD I/O configuration. My code structure is basically the same as the pure ST library code I used before, but somehow the LCD didn't display the string. (But the LED4 still turns on, which means PAL should be working fine) I wonder if there's any internal setup I overlook in ChibiOS?
The PAL driver has been enabled in halconf.h.
I tried to use the system call but there seemed to be some conflict in GPIO_TypeDef.
Currently I'm trying to control the LCD board on top of stm32l-discovery. To avoid the compile error I encountered, I decided to use the GPIO_TypeDef under pal_lld.h, and change the code in LCD I/O configuration. My code structure is basically the same as the pure ST library code I used before, but somehow the LCD didn't display the string. (But the LED4 still turns on, which means PAL should be working fine) I wonder if there's any internal setup I overlook in ChibiOS?
The PAL driver has been enabled in halconf.h.
Code: Select all
int main(void) {
halInit();
chSysInit();
palSetPadMode(GPIOA, 1|2|3|8|9|10|15, PAL_MODE_ALTERNATE(11));
palSetPadMode(GPIOB, 3|4|5|8|9|10|11|12|13|14|15, PAL_MODE_ALTERNATE(11));
palSetPadMode(GPIOC, 0|1|2|3|6|7|8|9|10|11, PAL_MODE_ALTERNATE(11));
palSetPadMode(GPIOB, 6, PAL_MODE_OUTPUT_PUSHPULL);
RCC_Config(); /* not sure where to configure clock for the LCD, so I do it here... */
LCD_GLASS_Init(); /* from the library stm32l_discovery_lcd.c */
while(TRUE) {
palSetPad(GPIOB, GPIOB_LED4); /*LED blinks*/
chThdSleepMilliseconds(500);
palClearPad(GPIOB, GPIOB_LED4);
chThdSleepMilliseconds(500);
LCD_GLASS_DisplayString("123456");
}
}
void RCC_Config(void)
{
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA | RCC_AHBPeriph_GPIOB | RCC_AHBPeriph_GPIOC, ENABLE);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR | RCC_APB1Periph_LCD, ENABLE);
/* Allow access to the RTC */
PWR_RTCAccessCmd(ENABLE);
/* Reset Backup Domain */
RCC_RTCResetCmd(ENABLE);
RCC_RTCResetCmd(DISABLE);
/*!< LSE Enable */
RCC_LSEConfig(RCC_LSE_ON);
/*!< Wait till LSE is ready */
while (RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET)
{}
/*!< LCD Clock Source Selection */
RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE);
}
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: stm32lib - where do I get it from
You are using setPadMode() in a wrong way, you can specify only a single pad there. See palSetPortMode() instead.
BTW "1|2|3|8|9|10|15" = 15, you cannot OR numbers like that.
Giovanni
BTW "1|2|3|8|9|10|15" = 15, you cannot OR numbers like that.
Giovanni
Re: stm32lib - where do I get it from
Ah ha, i see... The OR thing really messed up my I/O config.
It works fine now. Thanks you so much!
S.
It works fine now. Thanks you so much!
S.