2007-12-04 02:16:56 stack traces using bfin_spi_adc driver
Ramakrishna Bodhula (INDIA)
Message: 48101
Hello,
I am facing problem in using ' bfin_spi_adc ' driver. When I give command "spi_test "Test" ", then the following
stack trace comes continuosly.
CURRENT PROCESS:
COMM=spi_test PID=93
TEXT = 0x03620040-0x03623ec0 DATA = 0x03623ec4-0x03624914
BSS = 0x03624914-0x03624b94 USER-STACK = 0x03627f74
return address: 0x0009a3f0; contents of [PC-16...PC+8]:
RETE: 00000000 RETN: 034e9e24 RETX: 0009a3f0 RETS: 0008afa0
IPEND: 8030 SYSCFG: 0036
SEQSTAT: 00060027 SP: 034e9d48
R0: 0009a418 R1: 034e9e58 R2: 00000054 R3: 00000000
R4: 00000000 R5: 00000003 R6: 034e9e30 R7: 00000004
P0: 034e9ea8 P1: 00000000 P2: 034e9e80 P3: 03623e88
P4: 03627fa2 P5: 034e9e58 FP: 03627eec
A0.w: 00000000 A0.x: 00000000 A1.w: 00000000 A1.x: 00000000
LB0: 03620fd9 LT0: 03620fd6 LC0: 00000000
LB1: 0343ee69 LT1: 0343ee68 LC1: 00000000
B0: 00000000 L0: 00000000 M0: 00000000 I0: 00000001
B1: 00000000 L1: 00000000 M1: 00000000 I1: 03623e88
B2: 00000000 L2: 00000000 M2: 00000000 I2: 00000000
B3: 00000000 L3: 00000000 M3: 00000000 I3: 00000000
USP: 03627ee0 ASTAT: 02002020
DCPLB_FAULT_ADDR=00000130
ICPLB_FAULT_ADDR=0009a3f0
Hardware Trace:
0 Target : <0x00004594> { _trap_c + 0x0 }
Source : <0xffa00b58> { _exception_to_level5 + 0xb4 }
1 Target : <0xffa00aa4> { _exception_to_level5 + 0x0 }
Source : <0xffa00aa2> { _ex_trap_c + 0x4e }
2 Target : <0xffa00a54> { _ex_trap_c + 0x0 }
Source : <0xffa00bf8> { _trap + 0x28 }
3 Target : <0xffa00bd0> { _trap + 0x0 }
Source : <0xffa0114e> { __common_int_entry + 0xd8 }
4 Target : <0xffa010ec> { __common_int_entry + 0x76 }
Source : <0xffa00ec4> { _return_from_int + 0x58 }
5 Target : <0xffa00ec4> { _return_from_int + 0x58 }
Source : <0xffa00e9a> { _return_from_int + 0x2e }
6 Target : <0xffa00e6c> { _return_from_int + 0x0 }
Source : <0xffa010e8> { __common_int_entry + 0x72 }
7 Target : <0xffa010e6> { __common_int_entry + 0x70 }
Source : <0xffa00490> { _asm_do_IRQ + 0x7c }
8 Target : <0xffa00488> { _asm_do_IRQ + 0x74 }
Source : <0x00010676> { __local_bh_enable + 0x3e }
9 Target : <0x00010638> { __local_bh_enable + 0x0 }
Source : <0x000108f0> { ___do_softirq + 0x94 }
10 Target : <0x000108e8> { ___do_softirq + 0x8c }
Source : <0x000108c8> { ___do_softirq + 0x6c }
11 Target : <0x000108ba> { ___do_softirq + 0x5e }
Source : <0x000109e4> { _tasklet_action + 0x7c }
12 Target : <0x000109de> { _tasklet_action + 0x76 }
Source : <0x000109ba> { _tasklet_action + 0x52 }
13 Target : <0x000109b8> { _tasklet_action + 0x50 }
Source : <0x0001aea6> { ___rcu_process_callbacks + 0xb6 }
14 Target : <0x0001aea0> { ___rcu_process_callbacks + 0xb0 }
Source : <0x0001ae36> { ___rcu_process_callbacks + 0x46 }
15 Target : <0x0001ae32> { ___rcu_process_callbacks + 0x42 }
Source : <0x0001aece> { ___rcu_process_callbacks + 0xde }
Stack from 034e9d28:
036052a0 ffa00b5c 0012871c 0012871c 00128710 00000001 ffffffff 036a4b60
0009a3f0 00008030 00060027 00000000 034e9e24 0009a3f0 0009a3f0 0008afa0
0009a418 02002020 0343ee69 03620fd9 0343ee68 03620fd6 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 03623e88 00000001 03627ee0 03627eec 034e9e58 03627fa2
Call Trace:
[<0009a418>] _spi_complete+0x0/0x4
[<0009a418>] _spi_complete+0x0/0x4
[<0008afa0>] _adc_spi_write+0xb4/0xc0
[<00084e68>] _tty_ldisc_deref+0x68/0x94
[<0000ffff>] _sys_getitimer+0x47/0x54
[<0009a418>] _spi_complete+0x0/0x4
[<0003432e>] _vfs_write+0x82/0x14c
[<000328ce>] _do_sys_open+0x92/0xac
[<0003489a>] _sys_write+0x32/0x64
[<000328ec>] _sys_open+0x0/0x24
[<00034868>] _sys_write+0x0/0x64
[<00119ba0>] ___alloc_bootmem_core+0x38/0x334
[<00119ba0>] ___alloc_bootmem_core+0x38/0x334
[<00008000>] _coreb_lseek+0x28/0xa0
Can any body help me?
Regards,
Ramakrishna
QuoteReplyEditDelete
2007-12-04 02:32:19 Re: stack traces using bfin_spi_adc driver
Mike Frysinger (UNITED STATES)
Message: 48103 you'll need to actually describe your setup
what toolchain/kernel version ? what development platform ? what hardware do you have hooked up ? what drivers do you have enabled ? what does `dmesg` after boot ?
QuoteReplyEditDelete
2007-12-04 04:08:59 Re: stack traces using bfin_spi_adc driver
Ramakrishna Bodhula (INDIA)
Message: 48107
Hello Mike,
I am using BF561 EZ kit for my application. The uclinux distribution version is "uClinux-dist-2007R1-RC3".
I want to see some data on the MOSI line of SPI. For this I have enabled "bfin_spi_adc" driver and "spi_test" program.
The output of dmesg after kernel boot is ........
---------------------------------------------
Linux version 2.6.19.3-ADI-2007R1-svn (root@ramakrishnab) (gcc version 4.1.1 (ADI 07R1)) #18 Mon Dec 3 23:56:16 IST 2007
Warning: limiting memory to 55MB due to hardware anomaly 05000263
Blackfin support (C) 2004-2006 Analog Devices, Inc.
Compiled for ADSP-BF561 Rev. 0.3
Blackfin uClinux support by http://blackfin.uclinux.org/
Processor Speed: 600 MHz core clock and 120 Mhz System Clock
Board Memory: 64MB
Kernel Managed Memory: 64MB
Memory map:
text = 0x00001000-0x00111bb8
init = 0x00112000-0x00120a7c
data = 0x001229d8-0x00159dbc
stack = 0x00124000-0x00126000
bss = 0x00159dc0-0x0016883c
available = 0x0016883c-0x03700000
rootfs = 0x03700000-0x03f00000
DMA Zone = 0x03f00000-0x04000000
On node 0 totalpages: 14080
DMA zone: 110 pages used for memmap
DMA zone: 0 pages reserved
DMA zone: 13970 pages, LIFO batch:3
Normal zone: 0 pages used for memmap
Instruction Cache Enabled
Data Cache Enabled (write-through)
Hardware Trace Enabled
Built 1 zonelists. Total pages: 13970
Kernel command line: root=/dev/mtdblock0 rw console=ttyBF0,57600
Configuring Blackfin Priority Driven Interrupts
PID hash table entries: 256 (order: 8, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Physical pages: 3700
Memory available: 54272k/64373k RAM, (58k init code, 1090k kernel code, 58k data, 1024k dma)
Blackfin Scratchpad data SRAM: 4 KB
Blackfin DATA_A SRAM: 16 KB
Blackfin DATA_B SRAM: 16 KB
Blackfin Instruction SRAM: 16 KB
Calibrating delay loop... 1196.03 BogoMIPS (lpj=2392064)
Security Framework v1.0.0 initialized
Capability LSM initialized
Mount-cache hash table entries: 512
NET: Registered protocol family 16
Blackfin GPIO Controller
Blackfin DMA Controller
ezkit_init(): registering device resources
NET: Registered protocol family 2
IP route cache hash table entries: 512 (order: -1, 2048 bytes)
TCP established hash table entries: 2048 (order: 1, 8192 bytes)
TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
TCP: Hash tables configured (established 2048 bind 1024)
TCP reno registered
BF561 Core B driver v0.1 initialized.
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler cfq registered
pfx: pfbits driver for bf5xx
PPI: ADSP PPI Frame Capture Driver IRQ:18
timer_initialize: module loaded
PPI: can't get major 241
pfx: pfbits driver for bf5xx
Serial: Blackfin serial driver
bfin-uart.1: ttyBF0 at MMIO 0xffc00400 (irq = 35) is a BFIN-UART
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
smc91x: not found (-19).
uclinux[mtd]: RAM probe address=0x3700000 size=0x800000
Creating 1 MTD partitions on "RAM":
0x00000000-0x00800000 : "ROMfs"
uclinux[mtd]: set ROMfs:EXT2 to be root filesystem
TCP cubic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
VFS: Mounted root (ext2 filesystem).
Freeing unused kernel memory: 56k freed (0x112000 - 0x11f000)
dma_alloc_init: dma_page @ 0x0011b000 - 256 pages at 0x03f00000
root:~>
QuoteReplyEditDelete
2007-12-04 09:45:03 Re: stack traces using bfin_spi_adc driver
Robin Getz (UNITED STATES)
Message: 48140 Ramakrishnia:
You still never answered all of Mike's questions. Do you have any SPI devices connected? What user space application are you running to get SPI activity?
-Robin
QuoteReplyEditDelete
2007-12-04 20:27:51 Re: stack traces using bfin_spi_adc driver
Richard Stofer (UNITED STATES)
Message: 48162 I get that dump when the command line doesn't contain a string. If I just do:
root:~> spi_test
I will get the errors. OTOH, if I do:
root:~> spi_test "How Now Brown Cow"
I get:
Set slave receive count to 17 bytes
Last TX msg: How Now Brown Cow
The following code is stripped from an application I have working on my BF537 STAMP
int spi_fd;
int pf6_fd;
if ( (spi_fd = open("/dev/spi", O_RDWR)) < 0 ) {
printf("Error opening /dev/spi\n");
return 1;
}
ioctl(spi_fd, CMD_SPI_SET_BAUDRATE,0x1234); // approx 6.25 Mbits
ioctl(spi_fd, CMD_SPI_OUT_ENABLE, CFG_SPI_OUTENABLE);
ioctl(spi_fd, CMD_SPI_SET_MASTER, CFG_SPI_MASTER);
ioctl(spi_fd, CMD_SPI_SET_LENGTH16, CFG_SPI_WORDSIZE16); // 16 bits per word
ioctl(spi_fd, CMD_SPI_MISO_ENABLE, CFG_SPI_MISOENABLE);
ioctl(spi_fd, CMD_SPI_SET_POLAR, CFG_SPI_ACTLOW);
ioctl(spi_fd, CMD_SPI_SET_PHASE, CFG_SPI_PHASESTART);
ioctl(spi_fd, CMD_SPI_SET_CSENABLE, CFG_SPI_CS1VALUE);
ioctl(spi_fd, CMD_SPI_SET_CSLOW, CFG_SPI_CS1VALUE);
ioctl(spi_fd, CMD_SPI_SET_ORDER, CFG_SPI_MSBFIRST);
ioctl(spi_fd, CMD_SPI_SET_TRIGGER_MODE, 0);
if ( (pf6_fd = open("/dev/pf6", O_RDWR)) < 0 ) {
printf("Error opening /dev/pf6\n");
return 1;
}
ALUselect();
write(spi_fd, TrialVector, 3);
read(spi_fd, ResponseVector, 4);
ALUdeselect();
I wanted to frame the entire write/read transaction with a CSn so I used /dev/pf6 and wrote a couple of functions:
void ALUselect(void)
{
write(pf6_fd, "0", sizeof ("0"));
}
void ALUdeselect(void)
{
write(pf6_fd, "1", sizeof ("1"));
}
All of this stuff came from the samples I found in the distribution.
Oh, and you don't need a device on the MOSI line in order for spi_test to work.
Richard
QuoteReplyEditDelete
2007-12-04 20:33:08 Re: stack traces using bfin_spi_adc driver
Richard Stofer (UNITED STATES)
Message: 48163 One wierd thing I didn't point out: in the code
ALUselect();
write(spi_fd, TrialVector, 3);
read(spi_fd, ResponseVector, 4);
ALUdeselect();
Both TrialVector and ResponseVector are arrays of unsigned short (16 bit). The write function properly writes 3 unsigned shorts but to get the read function to read 2 unsigned shorts, the 3rd parameter needs to be 4. I have no idea why this happens but I have watched this on a logic analyzer and that's what I need to do to read 2 16-bit values.
I would like to know 'why?' but I'm not losing sleep over it. My app works and that's all I care about.
Richard
QuoteReplyEditDelete
2007-12-04 22:28:47 Re: stack traces using bfin_spi_adc driver
Yi Li (CHINA)
Message: 48167 Hi,
The spi_adc document: http://docs.blackfin.uclinux.org/doku.php?id=adsp-spiadc_documentation, the spi_adc driver: linux-2.6.x/drivers/char/bfin_spi_adc.c and the sample application: /uclinux-dist/user/blkfin-test/spi-test are not synchronized. I am going to open a bug for it. But for now, for your application, please try to read linux-2.6.x/drivers/char/bfin_spi_adc.c, and based you work on that.
-Yi
QuoteReplyEditDelete
2007-12-05 00:01:09 Re: stack traces using bfin_spi_adc driver
Ramakrishna Bodhula (INDIA)
Message: 48169
Hello Robin,
I am using BF561 EZ kit. The BF561 is interfaced with AD1836 codec on SPI bus. But at present I am bothered to see data on MOSI line of BF561.
The user space application I am running is "spi_test"
Regards,
Ramakrishna
QuoteReplyEditDelete
2007-12-05 00:04:33 Re: stack traces using bfin_spi_adc driver
Ramakrishna Bodhula (INDIA)
Message: 48170
Hello Richard,
Thank you for your reply.
I get the dump even after I give
root:> spi_test "Test 123"
Regards,
Ramakrishna
QuoteReplyEditDelete
2007-12-05 00:06:06 Re: stack traces using bfin_spi_adc driver
Richard Stofer (UNITED STATES)
Message: 48171 Yes, the SPI.C code is where I got most of the ideas.
When you mention the 'bug' are you referring to the number of elements transferred while reading 16-bit data?
Richard
QuoteReplyEditDelete
2007-12-05 01:33:06 Re: stack traces using bfin_spi_adc driver
Yi Li (CHINA)
Message: 48174 > "When you mention the 'bug' are you referring to the number of elements transferred while reading 16-bit data?"
No. I mean the driver, doc, sample do not match with each other. please refer to https://blackfin.uclinux.org/gf/project/uclinux-dist/tracker/?action=TrackerItemEdit&tracker_item_id=3756.
QuoteReplyEditDelete
2009-01-19 05:57:48 Re: stack traces using bfin_spi_adc driver
Jörg Dinger (GERMANY)
Message: 68100
Hello Richard!
I am interested in the include files you used.
Could you please send a post.
Thx.
J.D.