/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / Primer 1 - CAN on extansion header

Username:     
Password:     
             

Forum

# 1   2009-03-29 16:39:58 Primer 1 - CAN on extansion header

wostok
New member
Registered: 2009-03-28
Posts: 3

Primer 1 - CAN on extansion header

Hi,

i'm trying to use CAN on the extansion header of the Primer 1 for a while now but it doesn't work.
I'm using arm-gcc from codesourcery (2008q1-126), the fwlib v2.0.3 and OOCD which seem to work flawlessly with the Primer 1.
To use CAN on the header i have to remap it to PB8 and PB9.
I think i have a problem there.
Has anyone a hint for me in which order i have to initialise the hardware(after the clock-init).

In which order do i have to remap and initialise the ports to map CAN to PB8 and PB9?

Right now i use the following procedure which doesn't work:

-enable clock for Port B and AFIO: RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOB, ENABLE
-enable clock for CAN: RCC_APB1Periph_CAN, ENABLE
-init TX - PB9 as output AFIO
-init RX - PB8 as input IPU
-remap GPIO_Remap1_CAN, ENABLE
-CAN_DeInit
-CAN_StructInit
-set up CAN to 125kHz and 87.5% sampling point

The problem now is that TX(PB9) is driven low all the time, blocking the bus.
RX(PB8) driven high from the transceiver, which is ok. The other bus node is a Peak-CAN USB also set to the bus parameters mentioned above. The PeakCAN works very well with other bus-nodes.

Thx in advance, Paul

Offline

 

# 2   2009-03-29 20:30:28 Primer 1 - CAN on extansion header

kubsztal
Member
Registered: 2009-01-27
Posts: 15

Re: Primer 1 - CAN on extansion header

Hi Paul,

I have primer2 only so I can't check your settings for primer1, but what I'm configuring in other sequence is remapping GPIO just after enabling the clocks. Then RX and TX. Also TX I'm setting as AFPP but there is no option like AFIO in stm32f10x_gpio.h (last version of fwlib) so this seems to be the same (it's 0x18 in my case). Dominant TX suggests something NOK with the configuration of output pin...

Offline

 

# 3   2009-03-30 06:15:28 Primer 1 - CAN on extansion header

wostok
New member
Registered: 2009-03-28
Posts: 3

Re: Primer 1 - CAN on extansion header

Hi Kubsztal,

thanks for the reply, and what you tell sounds logical. I will try it and see if it works.
Thanks a lot!

Regards, Paul

Offline

 

# 4   2009-03-31 19:34:36 Primer 1 - CAN on extansion header

wostok
New member
Registered: 2009-03-28
Posts: 3

Re: Primer 1 - CAN on extansion header

Hi,

it works, the problem was the wrong initialisation.
Thanks to Kubszal

Paul

Offline

 

Board footer