2012-06-20 02:19 PM
hi.
i am using the STM32F107VC board from IAR i have some example code for CAN but in my Board they used the PD0 and PD1 for CAN i dont know how to remap it in my code. i have 2 board and i want to sent data between 2 boards.void GPIO_Configuration(void){ GPIO_InitTypeDef GPIO_InitStructure; // GPIO_PinRemapConfig(GPIO_Remap2_CAN1 , ENABLE); /* Configure CAN pin: RX */ //GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0; GPIO_InitStructure.GPIO_Pin = GPIO_Pin_CAN_RX; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU; GPIO_Init(GPIO_CAN, &GPIO_InitStructure); /* Configure CAN pin: TX */ //GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1; GPIO_InitStructure.GPIO_Pin = GPIO_Pin_CAN_TX; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIO_CAN, &GPIO_InitStructure); GPIO_PinRemapConfig(GPIO_Remap_CAN , ENABLE);}can any one pls help me solve this problem..thanks...2012-06-20 03:50 PM
Probably not enabling the AFIO clock.
/* Enable GPIOD and AFIO clocks for remapping */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO | RCC_APB2Periph_GPIOD, ENABLE);
/* Configure CAN1 RX pin */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;
GPIO_Init(GPIOD, &GPIO_InitStructure);
/* Configure CAN1 TX pin */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOD, &GPIO_InitStructure);
/* Remap CAN1 GPIOs */
GPIO_PinRemapConfig(GPIO_Remap2_CAN1 , ENABLE); /* PD 0 and 1 */
/* CAN1 Periph clock enable */
RCC_APB1PeriphClockCmd(RCC_APB1Periph_CAN1, ENABLE);
/* CAN1 register init */
CAN_DeInit(CAN1);
// ...
2012-06-20 04:15 PM
i change accordingly but It also not working....
readme.txt say's likeConnectivity line devices are STM32F105xx and STM32F107xx microcontrollers.STM3210C-EVAL (STM32F10x -- Connectivity line)my LED r connected in my board to PC.06, PC.07, PC.08 and PC.09 pinswhich suits with set-up - STM3210B-EVAL Set-up - Use LED1, LED2, LED3 and LED4 leds connected respectively to PC.06, PC.07, PC.08 and PC.09 pins - Use Push Button connected to PB9 - Connect a female/female CAN cable between at least 2 EVAL CAN connectors (on STM3210B-EVAL (CN2)/ STM3210E-EVAL (CN4) boards) - Connector 1 DB9_PIN2 to Connector 2 DB9_PIN2 (CAN_L) - Connector 1 DB9_PIN5 to Connector 2 DB9_PIN5 ( GND ) - Connector 1 DB9_PIN7 to Connector 2 DB9_PIN7 (CAN_H) @note JP3 must be fitted. @note Any unit in the CAN bus may play the role of sender (by pressing on the key) or receiver.so because of LED i am using STM3210B-EVAL Set-up how can i change the LED pin if i use STM3210C-EVAL Set-up - Use LED1, LED2, LED3 and LED4 connected respectively to PD.07, PD.13, PF.03 and PD.04 pins - Use Push Button connected to PB9 - Connect a female/female CAN cable between at least 2 EVAL CAN connectors (on STM3210E-EVAL (CN2)/ STM3210C-EVAL (CN3) boards) - Connector 1 DB9_PIN2 to Connector 2 DB9_PIN2 (CAN_L) - Connector 1 DB9_PIN5 to Connector 2 DB9_PIN5 ( GND ) - Connector 1 DB9_PIN7 to Connector 2 DB9_PIN7 (CAN_H) @note JP6 or JP5 must be fitted.as in my board LED r connected to PC.06, PC.07, PC.08 and PC.09 pinsthanks...2012-06-20 05:35 PM
Ok, so what board do you actually have? Does it have a revision number?
The STM3210C-EVAL, from ST, has CN3 connected to PD0,1 for CAN1 and LD1/LED1 is PD7 Get a schematic for your IAR board and determine what is connected where.2012-06-20 06:12 PM
thanks for your reply..
i useIAR KickStart Kit for STM32F107VC
i have attached theschematic of my board in this. in my board the pin are LED1(STAT1)- PC6 LED2(STAT2)- PC7 LED3(STAT3)- PC8 LED4(STAT4)- PC9 CAN1_TX - PD1 CAN1_RX - PD0 CAN1_CNTRL - PD14 there is Jumper settings in my board: CAN1_T OPEN- CAN1 Termination Disable CLOSE- CAN1 Termination Enable(Default) i have not change any of jumper its CLOSE i guess... thanks... ________________ Attachments : IAR-STM32F107VC-SK_REV-1.pdf : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0fw&d=%2Fa%2F0X0000000bea%2FmJ66jtfM39hbTgLWLlmyEJ8r_R87kfybaO3TzS1ZflU&asPdf=false2012-06-20 07:37 PM
Then you'll need to configure PD14 as a GPIO output, and drive it appropriately to enable the transceiver. The ST boards have a jumper to VCC or GND
2012-06-21 02:24 AM
can you please expline me shortly about GPIO config PD14...
2012-06-21 02:15 PM
can you please expline me shortly about GPIO config PD..
Really? If I scan the schematic and datasheet correctly :/* Configure PD14 in output pushpull mode */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_14;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(GPIOD, &GPIO_InitStructure);
Then
GPIO_SetBits(GPIOD, GPIO_Pin_14); // Set Transceiver in Transmit Enable (Dominant when CAN_TX LOW, otherwise Recessive)
or
GPIO_ResetBits(GPIOD, GPIO_Pin_14); // Set Transceiver in Receive Only
http://www.ti.com/lit/ds/symlink/sn65hvdpdf
2012-06-21 03:51 PM
Hi,
thanks for your reply and for your timei did so still no change...i am trying it for long time but noting happening...2012-06-21 04:05 PM
Time to break out the oscilloscope.