Linux bluetooth development
 help / color / mirror / Atom feed
* [Bluez-users] Change the uart baud rate for Semtech-Xemics kit
@ 2006-11-23 21:36 Michel Leconte
  0 siblings, 0 replies; only message in thread
From: Michel Leconte @ 2006-11-23 21:36 UTC (permalink / raw)
  To: bluez-users


[-- 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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-11-23 21:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-23 21:36 [Bluez-users] Change the uart baud rate for Semtech-Xemics kit Michel Leconte

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox