Linux bluetooth development
 help / color / mirror / Atom feed
From: Michel Leconte <leconte.michel@cegetel.net>
To: bluez-users@lists.sourceforge.net
Subject: [Bluez-users] Change the uart baud rate for Semtech-Xemics kit
Date: Thu, 23 Nov 2006 22:36:30 +0100	[thread overview]
Message-ID: <002b01c70f47$70ba4a20$27b44856@claudia> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 2334 bytes --]

Hi all,

I write a small function to modify the uart baud rate at the setup of the link between the stack bluez 
and the chip bluetooth. This function is highly inspired from functions in the hciattach.c file 
thanks to marcel. This function is specific to the development kit of Semtech-Xemics based on the
SX1441 (bluetooth v1.2).

I don't know if that can be usefull but I send you the output of the "diff"
command between the original hciattach.c and thus modified.

regards.

Michel  


------------------ output of the diff command --------------------------------

804a805,900
> 
> 
> 
> 
> 
> /*
>  * Specific initialization for semtech-xemics
>  * development kit based on the SX1441 Bluetooth v1.2
>  * 
>  */
> static int xemics(int fd, struct uart_t *u, struct termios *ti)
> {
>  struct timespec tm = {0, 50000};
>  char cmd[13];
>   
>  
>  
>  cmd[0] = HCI_COMMAND_PKT;
>  cmd[1] = 0x0b;   // OCF = Hci_Cmd_xemics_Set_Uart_Baud_Rate
>  cmd[2] = 0xfc;   // OGF = Vendor specific
>  cmd[3] = 0x09;
>  cmd[4] = 0x08;   
>  cmd[5] = 0x02;   
>  cmd[6] = 0x00;
>  
>  
>  
>  /* Xemics set baud rate command */ 
>  /*   BaudRate cmd[7]---cmd[10]
>  /* 115200 = 0x01C200
>   230400 = 0x038400
>   460800 = 0x070800
>   921600 = 0x0E1000 
>   
>   Important : cmd[7] = LSB first        */
>   
>  
>  switch (u->speed) {
>  
>  case 115200:
>   cmd[7] = 0x00 ;
>   cmd[8] = 0xC2;
>   cmd[9] = 0x01;
>   cmd[10] = 0x00 ;
>   
>   break;
>  case 230400:
>   cmd[7] = 0x00 ;
>   cmd[8] = 0x84;
>   cmd[9] = 0x03;
>   cmd[10] = 0x00 ;
>   break;
>  case 460800:
>   cmd[7] = 0x00;
>   cmd[8] = 0x08;
>   cmd[9] = 0x07;
>   cmd[10] = 0x00;
>   break;
>  case 921600:
>   cmd[7] = 0x00;
>   cmd[8] = 0x10;
>   cmd[9] = 0x0E;
>   cmd[10] = 0x00 ;
>   break;
>  default:
>   cmd[7] = 0x00 ;
>   cmd[8] = 0xC2;
>   cmd[9] = 0x01;
>   cmd[10] = 0x00 ;
>   
>   u->speed = 115200;
>   break;
>  }
>  
>    
>  cmd[11] = 0xb1;   
>  cmd[12] = 0x03;
> 
>  
>  /* Send  uart rate */
>  if (write(fd, cmd, 13) != 13) {
>   perror("Can't write reset cmd.");
>   return -1;
>  }
> 
>  nanosleep(&tm, NULL);
> 
> 
> 
>  
>  return 0;
> }
> 
> 
> 
> 
857a954,957
>  /* Semtech Xemics development kit  based on the SX1441 (bluetooth chip v1.2) */
>  { "xemics",      0x0000, 0x0000, HCI_UART_H4,   115200, 115200, FLOW_CTL , xemics   },
>  
>   

[-- Attachment #1.2: Type: text/html, Size: 4438 bytes --]

[-- Attachment #2: Type: text/plain, Size: 347 bytes --]

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

[-- Attachment #3: Type: text/plain, Size: 164 bytes --]

_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users

                 reply	other threads:[~2006-11-23 21:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='002b01c70f47$70ba4a20$27b44856@claudia' \
    --to=leconte.michel@cegetel.net \
    --cc=bluez-users@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox