Page 1 of 1

SD1 stupid problem

Posted: Sat Apr 11, 2015 8:35 pm
by fastlink30
i've a simple stupid problem, i can't send datas over serial (SD1)
on my custom board with stm32f103re, chibios 2.6.7

Code: Select all

    halInit();
    chSysInit();

    palSetPadMode(GPIOB, 6, PAL_MODE_STM32_ALTERNATE_PUSHPULL); // tx
    palSetPadMode(GPIOB, 7, PAL_MODE_INPUT); //rx
    sdStart(&SD1, NULL);

    shellInit();

....
    while (TRUE)
    {
        if (!shelltp_ser)
        {
            shelltp_ser = shellCreate(&shell_cfg_serial, SHELL_WA_SIZE, NORMALPRIO);
            LED2_ON;
        }
        else if (chThdTerminated(shelltp_ser))
        {
            shelltp_ser = NULL;           /* Triggers spawning of a new shell.   */
            LED2_OFF;
        }
sdWrite(&SD1,  (uint8_t *)"prova\r\n", 7);


no signal, if i try to toggle pins (changing SetpadMode configuration), is all ok

Re: SD1 stupid problem

Posted: Sat Apr 11, 2015 8:44 pm
by Giovanni
Those pins can be used with USART1 only using remapping, see the RM. I remember there are also errata regarding remapping so also read that document.

Giovanni

Re: SD1 stupid problem

Posted: Sun Apr 12, 2015 10:39 am
by fastlink30
is not the correct way to remap how i do?

errata talk about pa12, not my case

can't use PAL_MODE_ALTERNATE() with stm32f103re, right?

when book about chibios is supposed to be ready?

Re: SD1 stupid problem

Posted: Sun Apr 12, 2015 10:47 am
by Giovanni
Hi,

Remapping is not handled by the PAL driver, it is done by writing into the AFIO_MAPR, you can do that in boardInit() in your board files.

The book will be ready sometime after the official 3.0 release.

Giovanni

Re: SD1 stupid problem

Posted: Sun Apr 12, 2015 3:41 pm
by fastlink30
thank you Giovanni,

on Boardinit() i put
AFIO->MAPR |= 4;

now is functional :)