2007-06-20 03:19:52 can blackfin BF537 stamp
Tilman Glötzner (GERMANY)
Message: 36492 Hello,
I am trying to commission the CAN of the blackfin stamp. It somehow seems not to work yet...
Sending:
1) modprobe can
2) send_can -b 800 -D /dev/can0 -d 0x140
I am getting this:
Open device /dev/can0
change Bit-Rate to 800 Kbit/s
opened /dev/can0 succesful, got can_fd = 3
transmit message 325
:: unknown 800 22528 96 0 0 0 tx: 64/ 0: rx: 64/ 0:
closed fd = 3 succesful
(the can monitoring node receives nothing )
Receiving:
1) modprobe can
2) receive -b 800
(nothing is received from other nodes)
Question:
1) Could the issue be an electrical one ? I just connected CANH and CANL. I did not connect ground as the other node
don't use ground either.
2) Does the blackfin supports 800 kbit/s ?
Thanks
Tilman
QuoteReplyEditDelete
2007-06-21 12:28:11 Re: can blackfin BF537 stamp
Miquel Soler i Mir (SPAIN)
Message: 36565 Hello, The CAN baudrate is not correct.
The possibles values are:
1000 Kbps
500 Kbps
250 Kbps
125 Kbps
100 Kbps.. and or less.
What system do you use to generate and receive the can mesages to/from the STAMP BOARD???
Why do you use 800 Kpbs? It's not standard by no way.
Miquel Soler i Mir
TranslateQuoteReplyEditDelete
2007-06-25 18:39:45 Re: can blackfin BF537 stamp
Tilman Glötzner (GERMANY)
Message: 36704 > What system do you use to generate and receive the can mesages to/from the STAMP BOARD???
I use a PCAN USB dongle from peak systems for testing. Once successful, I would like to
use the blackfin with a can module (http://can-do.moraco.info/). The can module run 800 kbit/s.
a) What happens once I am writing "800" into /proc/sys/Can/Baud ? Is this just ignored by the blackfin ?
b) Is it somehow possible to directly set the register determining the baud rate (without detouring via the linux kernelto much)
Thanks
Tilman
QuoteReplyEditDelete
2007-06-26 05:25:59 Re: can blackfin BF537 stamp
Miquel Soler i Mir (SPAIN)
Message: 36783 Hello.
You can visit the can4linux page to check this.
In this link (http://www.port.de/software/can4linux/ioctl_8c.html).
You can check that "e.g. th Blackfin only supports 100, 125, 250, 500 and 1000 Kbit/s (currently!))"
Under the line called "Setting the bit timng register" there are some lines which explain how to change the timing registers.
I hope that this information help you.
Miquel Soler i Mir
TranslateQuoteReplyEditDelete
2007-07-01 17:22:36 Re: can blackfin BF537 stamp
Miquel Soler i Mir (SPAIN)
Message: 41080 I add some code to test the bit timing.
I hope that this code help you.
Miquel Soler i Mir
CANTIM.c
TranslateQuoteReplyEditDelete
2007-07-06 16:39:34 Re: can blackfin BF537 stamp
Tilman Glötzner (GERMANY)
Message: 41253 Dear Miguel,
thanks for the source code, and I will try that once I have commissioned the CAN successfully.
I set the bit rate 500 kbit/s -- it still does not work:
(BlackFin)
root:~> receive -d -b 500
receive V 1.2, Oct 31 2006
(c) 1996-2006 port GmbH
using canmsg_t with 32 bytes
CAN device /dev/can0 opened in blocking mode
change Bit-Rate to 500 Kbit/s
then I send a CAN message of 3 bytes length.
And I get this:
(BlackFin)
Received with ret=1: 0.000000 id=-1
len=0 msg= flags=0x10
Do you happen to know what this means ?
Thanks
Tilman
QuoteReplyEditDelete
2007-07-08 05:54:29 Re: can blackfin BF537 stamp
Tilman Glötzner (GERMANY)
Message: 41260 Hello,
I went through the source code of "receive": The output indicates an error.
I am not sure about the meaning of the flags register though.
Cheers
Tilman
QuoteReplyEditDelete
2007-07-09 16:00:07 Re: can blackfin BF537 stamp
Tilman Glötzner (GERMANY)
Message: 41295 Hello,
I did some measurements today (see attached tif). I sent the same can message twice: first time by the blackfin, and the second time using a can tool. The 2 signals in the middle are the reference signals (M1, M2) while the upper and the lower signal (C1 and C2) are sent by the blackfin. The signals sent by the blackfin are completely odd -- consequently the can tool records an error frame whenever I sent a message from the blackfin.
I wonder what the problem is: Is it a malconfiguration of the blackfin-stamp ? Maybe a wrong jumper somewhere ?
Or is it related to the driver ? I am using the factory default version of ulinux, i.e. I did not flash the board -- maybe this an old version with a broken CAN driver ?
Is there a CAN howto for the blackfin availible somewhere ?
Thanks
Tilman
can.tif
QuoteReplyEditDelete
2007-07-10 03:36:44 Re: can blackfin BF537 stamp
Michael Hennerich (GERMANY)
Message: 41315
I don't remeber corretly but the driver requires a SCLK set to exactly to 125MHz.
Set VCO Mult to 20 and SCLK divider to 5.
Then the driver only supports one baudrate (Hardcoded) ...
You also need to check the switches on the STAMP board
-Michael
QuoteReplyEditDelete
2007-07-10 06:45:50 Re: can blackfin BF537 stamp
Miquel Soler i Mir (SPAIN)
Message: 41341 With Tiny Board I'm using this setting in kernel [25 MHz external clock]
Blackfin Processor Options --->
Clock Settings --->
[*] Re-program Clocks while Kernel boots?
(25) VCO Multiplier
(1) Core Clock Divider (NEW)
(5) System Clock Divider (NEW)
[ ] Half ClockIn
[ ] Bypass PLL
Miquel Soler i Mir
TranslateQuoteReplyEditDelete
2007-07-28 04:27:57 Re: can blackfin BF537 stamp
Tilman Glötzner (GERMANY)
Message: 42119 I tried to recompile -- but failed. The kernel itself successfully compiles and links. The library apparently does not.
Probably a configuration issue. Any advise ?
Thanks
Tilman
make[1]: Entering directory `/usr/src/uClinux-dist/linux-2.6.x'
CHK include/linux/version.h
CHK include/linux/utsrelease.h
Building modules, stage 2.
MODPOST 36 modules
make[1]: Leaving directory `/usr/src/uClinux-dist/linux-2.6.x'
for dir in lib user ; do [ ! -d $dir ] || make ARCH=blackfin -C $dir || exit 1 ; done
make[1]: Entering directory `/usr/src/uClinux-dist/lib'
for i in libm libg zlib libjpeg libbfdsp ; do make -C $i || exit $? ; done
make[2]: Entering directory `/usr/src/uClinux-dist/lib/libm'
bfin-uclinux-gcc -I../libc/include -O2 -pipe -fno-builtin -Wall -DEMBED -D__uClinux__ -isystem /usr/src/uClinux-dist/staging/usr/include -g -DFLOATS=1 -DL_printf ../libc/stdio2/printf.c -c -o printf.o
In file included from ../libc/stdio2/printf.c:27:
../libc/include/stdarg.h:3:28: error: machine/stdarg.h: No such file or directory
In file included from ../libc/stdio2/printf.c:34:
../libc/include/stdio.h:125: error: expected declaration specifiers or '...' before 'va_list'
../libc/include/stdio.h:126: error: expected declaration specifiers or '...' before 'va_list'
../libc/include/stdio.h:127: error: expected declaration specifiers or '...' before 'va_list'
../libc/include/stdio.h:129: error: expected declaration specifiers or '...' before 'va_list'
../libc/include/stdio.h:130: error: expected declaration specifiers or '...' before 'va_list'
../libc/include/stdio.h:131: error: expected declaration specifiers or '...' before 'va_list'
../libc/include/stdio.h:132: error: expected declaration specifiers or '...' before 'va_list'
../libc/stdio2/printf.c:36: error: expected declaration specifiers or '...' before 'va_list'
../libc/stdio2/printf.c: In function 'printf':
../libc/stdio2/printf.c:48: error: 'va_list' undeclared (first use in this function)
../libc/stdio2/printf.c:48: error: (Each undeclared identifier is reported only once
../libc/stdio2/printf.c:48: error: for each function it appears in.)
../libc/stdio2/printf.c:48: error: expected ';' before 'ptr'
../libc/stdio2/printf.c:51: warning: implicit declaration of function 'va_start'
../libc/stdio2/printf.c:51: error: 'ptr' undeclared (first use in this function)
../libc/stdio2/printf.c:52: error: too many arguments to function 'vfnprintf'
../libc/stdio2/printf.c:53: warning: implicit declaration of function 'va_end'
make[2]: *** [printf.o] Error 1
make[2]: Leaving directory `/usr/src/uClinux-dist/lib/libm'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/usr/src/uClinux-dist/lib'
make: *** [subdirs] Error 1
QuoteReplyEditDelete
2007-07-28 04:50:21 Re: can blackfin BF537 stamp
Mike Frysinger (UNITED STATES)
Message: 42120 your toplevel menuconfig is incorrect. you've selected "uC-libc" when you actually want "none".
QuoteReplyEditDelete
2007-08-15 17:37:25 Re: can blackfin BF537 stamp
Tilman Glötzner (GERMANY)
Message: 42928 500 kbit/s works now fine ... once one gets everything right things tend to just work...
Thanks for your help.
I have however one more question. Miguel posted a program to set the speed to 800 kbit/s on 2007-07-01. How do I get it onto the blackfin ?
Thanks
Tilman
QuoteReplyEditDelete
2007-08-16 04:15:45 Re: can blackfin BF537 stamp
Miquel Soler i Mir (SPAIN)
Message: 42950 Hallo Tilman.
I add some new code. In the last one the SJW has 0 and was not so goob.
1.- Makefile: to copiler the source code
2.- CANTIM.c: new source code
3.- CAN_UCLINUX.ods : openoffice document used to calculte the bittiming values. I colored some values to show a correct values.
In you host.
Copiler the source code
1.- make
2.- make cp // To copy to /tftpboot directory the file
In uClinux
1.- tftp -g -r cantest (ip of host) in my case 192.168.0.18
2.- chmod 777 cantest
3.- ./cantest 11 9 1
You can sen:
root:/mnt/mmc1/CANBIT> ./cantest 11 9 1
Start the program to test the bit timing
BRP:11
TSEG1:9
TSEG2:1
The new baudrate is 801.00 Kbps
The new bit timing is 84.00
CAN_CLOCK: 0xB i CAN_TIMING: 0x219
The CAN message has been received
ID:123 long = 8, INFO 94 85 72 09 48 27 39 00
The CAN message has been received
ID:123 long = 8, INFO 94 85 72 09 48 27 39 00
The CAN message has been received
ID:123 long = 8, INFO 94 85 72 09 48 27 39 00
The CAN message has been received
ID:123 long = 8, INFO 94 85 72 09 48 27 39 00
The CAN message has been received
ID:123 long = 8, INFO 94 85 72 09 48 27 39 00
The CAN message has been received
ID:123 long = 8, INFO 94 85 72 09 48 27 39 00
The CAN message has been received
ID:123 long = 8, INFO 94 85 72 09 48 27 39 00
The CAN message has been received
ID:123 long = 8, INFO 94 85 72 09 48 27 39 00
The CAN message has been received
ID:123 long = 8, INFO 94 85 72 09 48 27 39 00
The CAN message has been received
ID:123 long = 8, INFO 94 85 72 09 48 27 39 00
root:/mnt/mmc1/CANBIT>
If you need more help, report me the questions.
Thanks.
Miquel Soler i Mir
PS: In what part of Germany are you living?
CAN UCLINUX.ods
Makefile
CANTIM.c
TranslateQuoteReplyEditDelete
2007-08-16 15:40:10 Re: can blackfin BF537 stamp
Tilman Glötzner (GERMANY)
Message: 42976 Dear Miguel,
apparently, I was thinking way too complicated -- I thought to get this c program to work I need to include it somehow into the kernel/root image build chain...
Unfortunately, I am not using open office (yet) -- would you mind sending the ods file as pdf file ?
I am currently living in Stuttgart which is in the southern part of Germany (or to be more precise 48° 45' 46.90'' N 9°09'49.78'' E -- you may want to look it up using GoogleEarth -- please refrain from sending ICMBs :-))
Well, I will the program and the makefile a try now -- if I have further questions I will get back. Looking at it -- wouldn't it be cool to have the CAN baud calculation in the driver ? Once the user writes something into /proc/sys/CAN/BaudRate, the bit timing values could be calculated. It it should turn out that the baud value is not supported, the closest possible baudrate could be computed. The user can verify by reading proc/sys/CAN/BaudRate how successful he was in setting the baud rate....
Thanks
Tilman
QuoteReplyEditDelete
2007-08-17 02:54:32 Re: can blackfin BF537 stamp
Tilman Glötzner (GERMANY)
Message: 42997 Dear Miguel,
801 kbit/s seems not to work. Upon sending
echo "m s 0x222 8 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8" > /dev/pcan32
the error counter of the sending node is increased and I get this at the first attempt:
./cantest 11 9 1
Start the program to test the bit timing
BRP:11
TSEG1:9
TSEG2:1
The new baudrate is 801.00 Kbps
The new bit timing is 84.00
CAN_CLOCK: 0xB i CAN_TIMING: 0x219
The CAN message has been received
ID:ffffffff long = 8, INFO 01 02 03 04 05 06 07 08
All following attempts to resend the CAN message yield nothing. They are not
recognized by the blackfin and just increase the error counter on the sending node.
How did you calculate the settings for the baud rate ? Is it possible to set the baudrate exactly to 800 kbit/s.
Another issue might be the sample point with a bit on the CAN bus. To how many percent into the bit the
sample point is set by cantest ?
Thanks
Tilman
QuoteReplyEditDelete
2007-08-17 03:00:55 Re: can blackfin BF537 stamp
Miquel Soler i Mir (SPAIN)
Message: 42998 Hallo, I add the file in exel format.
You can use this programa to send can messages also.
In my case, I'm using this function to set up the baudarate when I init the my program. To change the baudrate when the program is running you can use the same function.
This week I'm in Karlsruhe but I will return to CATALONIA on sunday.
To modifier the driver at this moment I don't have enough ability to make. I hope in the future I will make.
Thanks
Miquel Soler i Mir
CAN UCLINUX.xls
TranslateQuoteReplyEditDelete
2007-08-17 04:44:41 Re: can blackfin BF537 stamp
Miquel Soler i Mir (SPAIN)
Message: 43003 I add a new exel page,
You can try will this new values. I change the VCO from 25 to 24.
Thanks
Miquel Soler i Mir
CAN UCLINUX.xls
TranslateQuoteReplyEditDelete
2007-08-19 13:58:44 Re: can blackfin BF537 stamp
Tilman Glötzner (GERMANY)
Message: 43073 Dear Miguel,
I changed #define SCLK to 120000 to accommodate for the reduced system clock, compiled, tftped to the target.
Then I tried with the following values but without success:
./cantest 9 7 5 (sample point at 60 %)
./cantest 9 9 3 (sample point at 73 %)
On the sender side, I just see the error counter increasing with each try. I would like to try with 500 kbit/s and VCO=24. Is 500 kbit/s possible with a clock of 120 khz ?
I hope you had a fun time in Karlsruhe which is actually not very far away from Stuttgart -- maybe 1.5 h by car.
Bye now,
Tilman
QuoteReplyEditDelete
2007-09-19 11:24:03 Re: can blackfin BF537 stamp
Miquel Soler i Mir (SPAIN)
Message: 44325 Hallo, Tilman
You finaly can work at 800Kbps and 500Kpbs with 120 Mhz of System clock?
Now, my project work at 600 Mhz of core and 120 Mhz of system clock and all the baudrate in CAN are working include 800 Mhz.
I don't have any problem to five to you the modification of the driver!
Thanks
Miquel Soler i Mir
TranslateQuoteReplyEditDelete
2007-11-20 15:29:35 Re: can blackfin BF537 stamp
Tilman Glötzner (GERMANY)
Message: 47123 Hello Miquel,
I did not get it working. I have to admit however that I did not try very hard :-) I would appreciate if you could sent me the modification of the driver.
Thanks
Tilman
QuoteReplyEditDelete
2007-11-21 14:03:01 Re: can blackfin BF537 stamp
Miquel Soler i Mir (SPAIN)
Message: 47202 Hallo Tilman, nice to meed you!
The last week I was working with CAN BUS.
I add some documentation.
1/2.- Driver CAN: this document containg the information to modifier the driver to work at 120 Mhz of System clock and new speeds.
3.- Exel: This document contain the calculation of CAN baudrate and bit timing
4/5.- I'm creating a library with the funcionts from CAN BUS. You can use!
If you have more problems please send me an email / post / or phone me at
www.rr-consult.net
Miquel Soler i Mir
Drivers de CAN (Tilma Germany).pdf
Drivers de CAN (Tilma Germany).doc
canlib.h
canlib.c
Calcul timing CAN Generic.xls
TranslateQuoteReplyEditDelete
2008-01-12 07:58:26 Re: can blackfin BF537 stamp
Tilman Glötzner (GERMANY)
Message: 49531 Dear Miquel,
it took me some time to check it out and get back to you. You succeeded ! After a couple of tries (contact problems on the physical layer :-)) I got the CAN working with signaling rate of 800 kbaud. Thank you for your support.
And the next question :-)
How do I use the /proc/sys/Can/dbgmask ?
I changed /drivers/char/can4linux/Makefile Line 410ff to
DEBUG=DEBUG=1
#DEBUG=NODEBUG
and recompiled (DEBUG=1 breaks the source code and it does not compile).
Then I did
echo "1" > /proc/sys/Can/dbgMask
and hoped to see some debug message in var/log/message -- which did not materialize.
Best Regards
Tilman