* [Bluez-devel] How to run up CSR chip without eeprom with BLUEZ ?
@ 2008-06-12 5:54 skyflame
2008-06-13 8:55 ` Sanja Kolundzija
0 siblings, 1 reply; 8+ messages in thread
From: skyflame @ 2008-06-12 5:54 UTC (permalink / raw)
To: BlueZ development, attaboyu, hong zhang
[-- Attachment #1.1: Type: text/plain, Size: 2541 bytes --]
Hi
I post this question on bluez-user before , But I think here might be the right place , so I put it here again.
My chip is CSR's bc4 A06 Rom which do not have eeprom and need to send pskey to init after power up.
Thanks to attaboyu and henry , They told me a way to do it with following process :
1. add --enable-bccmd feature while configure the bluez-utils
2. use bccmd after hci0 is up:
3. $bccmd -t hci psload -r /csr.psr
But I try it , and meet some problem:
the bluez-utils/tools/example.psr seems not comply with my chip, so I write another one as:
// PSKEY_ANA_FREQ
&01fe = 0FA0
// PSKEY_UART_BAUD_RATE
&01be = 0EBF
And then after hciconfig hci0 up I use
bccmd -t hci psload -r csr.psr
the two key is write successfully , but if I enable the debug I can see the chip continue to receive messages , seems something wrong with the head.
I remove the debug message so that you can see the log more clear:
~ #
~ # bccmd -t hci psload csr.psr
Loading PSKEY_ANA_FREQ ... done
Loading PSKEY_UART_BAUDRATE ... done
if I using -r in psload the result is :
~ # bccmd -t hci psload -r csr.psr
Loading PSKEY_ANA_FREQ ... done
Loading PSKEY_UART_BAUDRATE ... done
~ #
~ # bcsp_recv: Error in BCSP hdr checksum
both one could not work for hcitool scan:
~ # hcitool -i hci0 scan
Scanning ...
Inquiry failed: Connection timed out
and as long as this bcsp_recv: Error in BCSP hdr checksum happen
the bcsp interface seems dead , type bccmd again will show :
~ # bccmd -t hci psload -r csr.psr
Can't read version info for hci0: Connection timed out (110)
seems after warm reset the connection is bad.
So , I wonder, when using hciattach the baudrate is set to 115200
but after the uart_baudrate is set, the baudrate is set to 921600 it might cause the problem
Then I set &01be = 01d8 to keep the baudrate as 115200
But still the same.
Then if I remove the uart_baud_rate setting from the psr file
the warm reboot is ok:
~ # bccmd -t hci psload -r csr.psr
Loading PSKEY_ANA_FREQ ... done
but the chip seems to lost the sync and go back to the tshy state !
~ # hcitool -i hci0 scan
Scanning ...
bcsp_pkt_cull: Peer acked invalid packet
bcsp_handle_le_pkt: Found a LE sync pkt, card has reset
bcsp_pkt_cull: Peer acked invalid packet
bcsp_handle_le_pkt: Found a LE sync pkt, card has reset
bcsp_pkt_cull: Peer acked invalid packet
.
.
.
.
what is the right process ? Can any one help me out ?
Thanks
Raymond
[-- Attachment #1.2: Type: text/html, Size: 5046 bytes --]
[-- Attachment #2: Type: text/plain, Size: 247 bytes --]
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
[-- Attachment #3: Type: text/plain, Size: 164 bytes --]
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [Bluez-devel] How to run up CSR chip without eeprom with BLUEZ ? 2008-06-12 5:54 [Bluez-devel] How to run up CSR chip without eeprom with BLUEZ ? skyflame @ 2008-06-13 8:55 ` Sanja Kolundzija 2008-06-16 1:40 ` skyflame 0 siblings, 1 reply; 8+ messages in thread From: Sanja Kolundzija @ 2008-06-13 8:55 UTC (permalink / raw) To: BlueZ development, attaboyu, hong zhang > what is the right process ? Can any one help me out ? > Thanks =A0 > Raymond Hi Raymond, we are using BC6 ROM, and also had problems initializing it. This is the pr= ocedure that works for us: 1. We run bccmd before hciattach! bccmd -t BCSP -d /dev/ttyS2 psload -r pskeys.psr Obviously, BC6 is connected to ttyS2. = pskeys.psr looks like this: =A0 // PSKEY_BDADDR &0001 =3D 0044 5566 0033 1122 // PSKEY_UART_BAUDRATE - 921600 &01be =3D 0ebf // PSKEY_ANA_FREQ &01fe =3D 6590 Before executing bccmd, chip has baudrate 38400. After executing bccmd, bau= drate will be 921600, so hciattach has to use that speed.=A0 bccmd without -r didn't work for us. =A0 2. Now we run hciattach: hciattach -s 921600 /dev/ttyS2 bcsp 921600 noflow After this we do hciconfig hci0 reset, and continue working with hci0 devic= e normally from BlueZ. Regards, Sanja ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Bluez-devel mailing list Bluez-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bluez-devel ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Bluez-devel] How to run up CSR chip without eeprom with BLUEZ ? 2008-06-13 8:55 ` Sanja Kolundzija @ 2008-06-16 1:40 ` skyflame 2008-06-16 19:52 ` Sanja Kolundzija 0 siblings, 1 reply; 8+ messages in thread From: skyflame @ 2008-06-16 1:40 UTC (permalink / raw) To: Sanja Kolundzija, BlueZ development, attaboyu, hong zhang Hi Sanja Thanks for your instruction !! I found it behavior on my board a little different from you : If I using -r in the bccmd: ~ # bccmd -t bcsp -d /dev/ttyS1 psload -r csr.psr Loading PSKEY_ANA_FREQ ... done Loading PSKEY_UART_BAUDRATE ... done Loading PSKEY_UART_SEQ_WINSIZE ... done Loading PSKEY_BDADDR ... done Loading PSKEY_PCM_CONFIG32 ... done Loading PSKEY_PCM_FORMAT ... done Loading PSKEY_HOSTIO_MAP_SCO_PCM ... done Loading PSKEY_HOSTIO_MAP_SCO_CODEC ... done Loading PSKEY_CODEC_PIO ... done Loading PSKEY_ANA_FTRIM ... done ~ # ~ # hciattach -s 921600 /dev/ttyS1 bcsp 921600 BCSP initialization timed out It won't work, If I don't do reset at the same cmd, but instead do it seperately: ~ # bccmd -t bcsp -d /dev/ttyS1 psload csr.psr Loading PSKEY_ANA_FREQ ... done Loading PSKEY_UART_BAUDRATE ... done Loading PSKEY_UART_SEQ_WINSIZE ... done Loading PSKEY_BDADDR ... done Loading PSKEY_PCM_CONFIG32 ... done Loading PSKEY_PCM_FORMAT ... done Loading PSKEY_HOSTIO_MAP_SCO_PCM ... done Loading PSKEY_HOSTIO_MAP_SCO_CODEC ... done Loading PSKEY_CODEC_PIO ... done Loading PSKEY_ANA_FTRIM ... done ~ # ~ # bccmd -t bcsp -d /dev/ttyS1 warmreset ~ # ~ # hciattach -s 921600 /dev/ttyS1 bcsp 921600 ~ # ~ # hciconfig hci0 up ~ # Seems it can connect to the chip, but still, pskey don't set right , I can read it out and see it's still the reset value ...... ~ # bccmd psget -s 0x0 0x01be UART Baud rate: 0x0000 (0) I try to use following cmd to see whether the cmd is write in to the chip, but : ~ # bccmd -t bcsp -d /dev/ttyS1 psget -s 0x0 0x1be UART Baud rate: 0x0000 (0) ~ # ~ # bccmd -t bcsp -d /dev/ttyS1 psset -s 0x0 0x1be 0x0ebf ~ # ~ # bccmd -t bcsp -d /dev/ttyS1 psget -s 0x0 0x1be UART Baud rate: 0x0000 (0) seems chip just reset it self between two bccmd with bcsp protocol, and lost everything write to it. But if I set up the pskey use hci protocol after hciconfig up, it's ok. but reset lost the connection: ~ # hciattach -s 38400 /dev/ttyS1 bcsp ~ # ~ # hciconfig hci0 up ~ # ~ # bccmd psget -s 0x0 0x1be UART Baud rate: 0x0000 (0) ~ # ~ # bccmd psset -s 0x0 0x1be 0x01d8 ~ # ~ # bccmd psget -s 0x0 0x1be UART Baud rate: 0x01d8 (472) ~ # bccmd warmreset ~ # ~ # bcsp_recv: Error in BCSP hdr checksum Sigh ... Do you have any idea what might be wrong for my operation ? Raymond ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Bluez-devel mailing list Bluez-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bluez-devel ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Bluez-devel] How to run up CSR chip without eeprom with BLUEZ ? 2008-06-16 1:40 ` skyflame @ 2008-06-16 19:52 ` Sanja Kolundzija 2008-06-17 1:34 ` skyflame 2008-06-17 4:05 ` skyflame 0 siblings, 2 replies; 8+ messages in thread From: Sanja Kolundzija @ 2008-06-16 19:52 UTC (permalink / raw) To: skyflame, BlueZ development, attaboyu, hong zhang Hi Raymond, > If I using -r in the bccmd: > > ~ # bccmd -t bcsp -d /dev/ttyS1 psload -r csr.psr > Loading PSKEY_ANA_FREQ ... done > Loading PSKEY_UART_BAUDRATE ... done > Loading PSKEY_UART_SEQ_WINSIZE ... done > Loading PSKEY_BDADDR ... done > Loading PSKEY_PCM_CONFIG32 ... done > Loading PSKEY_PCM_FORMAT ... done > Loading PSKEY_HOSTIO_MAP_SCO_PCM ... done > Loading PSKEY_HOSTIO_MAP_SCO_CODEC ... done > Loading PSKEY_CODEC_PIO ... done > Loading PSKEY_ANA_FTRIM ... done > ~ # > ~ # hciattach -s 921600 /dev/ttyS1 bcsp 921600 > BCSP initialization timed out Which baud rate do you set in your .psr file? You should use the same speed in hciattach command, otherwise chip will be initialized to one speed, and hciattach will try to connect using another one. > I try to use following cmd to see whether the cmd is write in to the chip, > but : > > ~ # bccmd -t bcsp -d /dev/ttyS1 psget -s 0x0 0x1be > UART Baud rate: 0x0000 (0) > ~ # > ~ # bccmd -t bcsp -d /dev/ttyS1 psset -s 0x0 0x1be 0x0ebf > ~ # > ~ # bccmd -t bcsp -d /dev/ttyS1 psget -s 0x0 0x1be > UART Baud rate: 0x0000 (0) > > seems chip just reset it self between two bccmd with bcsp protocol, and lost > everything write to it. Yes, I had the same behaviour, and only if I use -r with first bccmd things worked. Reading the fault code returned FAULT_HOSTIO_INVALID_ACK (the chip received a BCSP ACK for a message it has not sent) - based on this I conclude that repeating bccmd messes the chips state machine during BCHS protocol initialization. Regards, Sanja ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Bluez-devel mailing list Bluez-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bluez-devel ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Bluez-devel] How to run up CSR chip without eeprom with BLUEZ ? 2008-06-16 19:52 ` Sanja Kolundzija @ 2008-06-17 1:34 ` skyflame 2008-06-17 4:05 ` skyflame 1 sibling, 0 replies; 8+ messages in thread From: skyflame @ 2008-06-17 1:34 UTC (permalink / raw) To: Sanja Kolundzija, BlueZ development, attaboyu, hong zhang Hi Sanja > If I using -r in the bccmd: > > ~ # bccmd -t bcsp -d /dev/ttyS1 psload -r csr.psr > Loading PSKEY_ANA_FREQ ... done > Loading PSKEY_UART_BAUDRATE ... done > Loading PSKEY_UART_SEQ_WINSIZE ... done > Loading PSKEY_BDADDR ... done > Loading PSKEY_PCM_CONFIG32 ... done > Loading PSKEY_PCM_FORMAT ... done > Loading PSKEY_HOSTIO_MAP_SCO_PCM ... done > Loading PSKEY_HOSTIO_MAP_SCO_CODEC ... done > Loading PSKEY_CODEC_PIO ... done > Loading PSKEY_ANA_FTRIM ... done > ~ # > ~ # hciattach -s 921600 /dev/ttyS1 bcsp 921600 > BCSP initialization timed out > Which baud rate do you set in your .psr file? You should use the same > speed in hciattach command, otherwise chip will be initialized to one > speed, and hciattach will try to connect using another one. I did set it to 0xebf for 921600: this is my psr file , actually I wirte this psr file according to the value I used in CSR bchs stack's boot_strap , these setting in bchs's stack can make the chip working normally : // PSKEY_ANA_FREQ &01fe = 0FA0 // PSKEY_UART_BAUD_RATE &01be = 0EBF // PSKEY_UART_SEQ_WINSIZE &0407 = 0006 // BDADDR &0001 = 1122 3344 5566 7788 // PCM_CONFIG32 &01b3 = 0080 0906 // PCM_FORMAT &01b6 = 0060 // MAP_SCO_PCM &01ab = 0001 // MAP_SCO_CODEC &01b0 = 0000 // CODEC_PIO &01b9 = 000b // ANA_FTRIM &01f6 = 0025 > I try to use following cmd to see whether the cmd is write in to the chip, > but : > > ~ # bccmd -t bcsp -d /dev/ttyS1 psget -s 0x0 0x1be > UART Baud rate: 0x0000 (0) > ~ # > ~ # bccmd -t bcsp -d /dev/ttyS1 psset -s 0x0 0x1be 0x0ebf > ~ # > ~ # bccmd -t bcsp -d /dev/ttyS1 psget -s 0x0 0x1be > UART Baud rate: 0x0000 (0) > > seems chip just reset it self between two bccmd with bcsp protocol, and lost > everything write to it. > Yes, I had the same behaviour, and only if I use -r with first bccmd > things worked. Reading the fault code returned FAULT_HOSTIO_INVALID_ACK > (the chip received a BCSP ACK for a message it has not sent) - based on > this I conclude that repeating bccmd messes the chips state machine > during BCHS protocol initialization. Thanks god, I finally find something that work the same way as you 8 ) though this is also not so promising... I had plan to modify the bccmd to set the pskey and read the pskey at one time, to see what make the bccmd not working for second time. Maybe it help to understand the stack behavior. Thanks. Raymond ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Bluez-devel mailing list Bluez-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bluez-devel ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Bluez-devel] How to run up CSR chip without eeprom with BLUEZ ? 2008-06-16 19:52 ` Sanja Kolundzija 2008-06-17 1:34 ` skyflame @ 2008-06-17 4:05 ` skyflame 2008-06-17 8:18 ` [Bluez-devel] What't the difference between HIDD / HID2HCI / Bluetoothd-service-input ? skyflame 2008-06-17 8:25 ` [Bluez-devel] How to run up CSR chip without eeprom with BLUEZ ? Sanja Kolundzija 1 sibling, 2 replies; 8+ messages in thread From: skyflame @ 2008-06-17 4:05 UTC (permalink / raw) To: Sanja Kolundzija, BlueZ development, attaboyu, hong zhang Hi sanja, attaboyu, henry Thanks for your help, I can do the hcitool scan now! It's my bad, I set the ANA_FREQ in worng way, At first I try bccmd -t bcsp way to set the ana_freq, And find it not work, and I use bccmd -t bcsp -d /dev/ttyS1 psget -s 0x0 0x1fe to read the value but it says Can't execute command: No such device or address (6) So I remove it. And when I do the following test again , I add it back, But ... shame , My chip is using 40M crystal , When I calculate the value I put 4000 in calc to get 0xfa0 , But it should be 40000 and thus 0x9c40 I check my csr.psr and correct it just now it works now. And I understand now, why bccmd -t bcsp -d /dev/ttyS1 psget -s 0x0 0x1fe got nothing at the biginning. This pskey unlike the other pskey say 0x1be , they have a "psrom" version value, so before you set it, you can read it out from "psrom" ( which can be done by -s 0x0 say "default" ) , and after you setting them , you can also read it out from "psram" , this pskey do not have default value in "psrom" ( strange ? ) and only after you successfully setting it , it can be read out. ( However, It is really strange here, without setting this value, why hciattach can connect the chip for the first time, while do a warmreset , it won't ? Is csr's chip do a self uart baudrate adjustment to match the host for the first time ? ) Thanks for all of you's help on this issue! So My process now is : boot up the fs insmod bluetooth.ko insmod hci_uart.ko insmod l2cap.ko insmod rfcomm.ko bccmd -t bcsp -d /dev/ttyS1 psload -r csr.psr hciattach -s 921600 /dev/ttyS1 bcsp 921600 hciconfig hci0 up hciconfig hci0 piscan hcitool -i hci0 scan Thanks again Hope I do not get further problems with those bluez daemons 8 ) Raymond > If I using -r in the bccmd: > > ~ # bccmd -t bcsp -d /dev/ttyS1 psload -r csr.psr > Loading PSKEY_ANA_FREQ ... done > Loading PSKEY_UART_BAUDRATE ... done > Loading PSKEY_UART_SEQ_WINSIZE ... done > Loading PSKEY_BDADDR ... done > Loading PSKEY_PCM_CONFIG32 ... done > Loading PSKEY_PCM_FORMAT ... done > Loading PSKEY_HOSTIO_MAP_SCO_PCM ... done > Loading PSKEY_HOSTIO_MAP_SCO_CODEC ... done > Loading PSKEY_CODEC_PIO ... done > Loading PSKEY_ANA_FTRIM ... done > ~ # > ~ # hciattach -s 921600 /dev/ttyS1 bcsp 921600 > BCSP initialization timed out Which baud rate do you set in your .psr file? You should use the same speed in hciattach command, otherwise chip will be initialized to one speed, and hciattach will try to connect using another one. > I try to use following cmd to see whether the cmd is write in to the chip, > but : > > ~ # bccmd -t bcsp -d /dev/ttyS1 psget -s 0x0 0x1be > UART Baud rate: 0x0000 (0) > ~ # > ~ # bccmd -t bcsp -d /dev/ttyS1 psset -s 0x0 0x1be 0x0ebf > ~ # > ~ # bccmd -t bcsp -d /dev/ttyS1 psget -s 0x0 0x1be > UART Baud rate: 0x0000 (0) > > seems chip just reset it self between two bccmd with bcsp protocol, and lost > everything write to it. Yes, I had the same behaviour, and only if I use -r with first bccmd things worked. Reading the fault code returned FAULT_HOSTIO_INVALID_ACK (the chip received a BCSP ACK for a message it has not sent) - based on this I conclude that repeating bccmd messes the chips state machine during BCHS protocol initialization. Regards, Sanja ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Bluez-devel mailing list Bluez-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bluez-devel ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bluez-devel] What't the difference between HIDD / HID2HCI / Bluetoothd-service-input ? 2008-06-17 4:05 ` skyflame @ 2008-06-17 8:18 ` skyflame 2008-06-17 8:25 ` [Bluez-devel] How to run up CSR chip without eeprom with BLUEZ ? Sanja Kolundzija 1 sibling, 0 replies; 8+ messages in thread From: skyflame @ 2008-06-17 8:18 UTC (permalink / raw) To: BlueZ development Hi I want to run up an hid daemon to connect hid device. I notice that there are several bin as : hidd hid2hci bluetoothd-service-input I try to figure out what is their difference by man, however , the man has only very short description. And also , I did not find many documents on how to write the related config files for each bluez daemons. So 1. Is there any good documents on describe the setting of different bluez daemons ? Or is there any good sample on setting up the daemons from scratch on embedded board ? 2. I can see on pc and on some system, it run bluetoothd-service-input but no hidd found. Is that hidd is out of date and replaced ? 3. Is the same situation with bluetoothd-service-audio and etc ? 4. Is that possible to use bluez to simulate a hid device ? say providing mouse function instead of acting as a server to use bt mouse ? Thanks. Raymond ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Bluez-devel mailing list Bluez-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bluez-devel ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Bluez-devel] How to run up CSR chip without eeprom with BLUEZ ? 2008-06-17 4:05 ` skyflame 2008-06-17 8:18 ` [Bluez-devel] What't the difference between HIDD / HID2HCI / Bluetoothd-service-input ? skyflame @ 2008-06-17 8:25 ` Sanja Kolundzija 1 sibling, 0 replies; 8+ messages in thread From: Sanja Kolundzija @ 2008-06-17 8:25 UTC (permalink / raw) To: skyflame, BlueZ development, attaboyu, hong zhang Hi Raymond, great that it works! These CSR ROM devices can be really frustrating. > ( However, It is really strange here, without setting this value, why > hciattach can connect the chip for the first time, while do a warmreset , it > won't ? Is csr's chip do a self uart baudrate adjustment to match the host > for the first time ? ) Yes, you are right, they perform auto-baud procedure at the beginning. They don't have any value set, but guess from the incoming message what is the baud rate. That's why if you look with the scope at signals, you see that chip doesn't reply to the first message from the processor, but needs typically few messages to guess the baud rate. Regards, Sanja ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Bluez-devel mailing list Bluez-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bluez-devel ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2008-06-17 8:25 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-06-12 5:54 [Bluez-devel] How to run up CSR chip without eeprom with BLUEZ ? skyflame 2008-06-13 8:55 ` Sanja Kolundzija 2008-06-16 1:40 ` skyflame 2008-06-16 19:52 ` Sanja Kolundzija 2008-06-17 1:34 ` skyflame 2008-06-17 4:05 ` skyflame 2008-06-17 8:18 ` [Bluez-devel] What't the difference between HIDD / HID2HCI / Bluetoothd-service-input ? skyflame 2008-06-17 8:25 ` [Bluez-devel] How to run up CSR chip without eeprom with BLUEZ ? Sanja Kolundzija
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox