SAMB11 Serial Chat Service

Go To Last Post
14 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I use the Serial Chat Service as example for create an custom application. I want to use this example as base for a application to exchange data between the SAMB11 and a smartphone like a old fashioned Serial port.

I understand in the meanwhile how things are working in the SAMB11. I use the Atmel Smart Connect App on a Samsung Galaxy to test the SCS app. Everything is working well.

But when I use an app like BLE Scanner to investigate how BLE works, I see for the SCS example a Custom Service with a Custom Characteristic with a NOTIFY property. When I type a word at the console (UART) the text appears at the VALUE field of the characteristic, so this is working. But I don't see a WRITE Propery to type a word at the Samsung. Can someone explain how it is possible to send data from the smartphone to the SAMB11 without using the Atmel Smart Connect app?

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If it doesn't have a WRITE property then you have to configure the code so that the SAMB11 exposes this characteristic. 

MADEIT

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you for your reply. I understand that I have to configure the code to have also a Write property, but my question was how it is working now without a WRITE property.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have a similar problem...To understand that I am trying to write simple app to control led..Inside this function I do my code.:

 static void csc_app_recv_buf(uint8_t *recv_data, uint8_t recv_len)
{
        
       
                if (recv_len)
                {
                    for (ind = 0; ind < recv_len; ind++)
                    {
                        //    DBG_LOG_CONT("%c", recv_data[ind]);
                        
                             if (recv_data[ind] == '1')
                            {

                              DBG_LOG("led on");

                              gpio_pin_toggle_output_level(PIN_LP_GPIO_15);    //EXT3_PIN_12   
                               
                            }

                             

                             if (recv_data[ind] == '2')

                            {

                              DBG_LOG("led off");

                              gpio_pin_toggle_output_level(PIN_LP_GPIO_15);    //EXT3_PIN_12  
                            }

                     }

               }

}

Once, my device is paired then I can send   '1' or '2' via Atmel smart connect apk chat terminal and thus my led is on or off. Problem is when I am trying to use my own apk (written in MIT app inventor )or any different ble terminal available on the play store, then after paired the bluetooth doesn't recognize incoming data..

Does this Atmel Serial Chat Service example code have any protection and not allow to send any data from different terminal than Atmel smart connect?hmm

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hey there!

 

The protection is in the bluetooth protocol. If the SAMB11 is acting as the peripheral\Server, the SAMB11 has to have a notification property. With this then your app, the Client should enable notifications from the Server. Once you enable notifications that come from the SAMB11, communication should be able to go both ways.

MADEIT

Last Edited: Fri. Jun 16, 2017 - 05:05 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi

No clue how to manage that communication. I found this function inside the code:

at_ble_status_t csc_prf_write_notification_handler(void *params)
{
 uint8_t data[2] = {1, 0};
 DBG_LOG("\r\n");
 if(at_ble_characteristic_write(app_csc_info.csc_desc.conn_handle, app_csc_info.csc_desc.desc_handle, 0, 2, data, false, true) == AT_BLE_FAILURE){
  DBG_LOG("\r\nFailed to send characteristic Write Request");
 }

 return AT_BLE_SUCCESS;
}

where:

at_ble_status_t at_ble_characteristic_write(at_ble_handle_t conn_handle, at_ble_handle_t char_handle, uint16_t offset, uint16_t length, uint8_t *data, bool signed_write, bool with_response);

 

Does it mean, if I send a frame of bytes from my apk to sam11 then the communication will be available? if so, How does it look that frame? I used a  ble scanner from app store to find some info about sam11 and found: descriptor uuid: 0x2902 ..how does it eat each other?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It has been awhile since I looked at this code, but I believe that the code you wrote is if the SAMB11 acts as a Client. So you have to do exactly that code over in your app and send it to the SAMB11. I don't understand this question.

 

I used a  ble scanner from app store to find some info about sam11 and found: descriptor uuid: 0x2902 ..how does it eat each other?

 

A lot of this info is actually really well documented through Nordic websites they have gone above and beyond maybe you should check some of their websites out. 

MADEIT

Last Edited: Sat. Jun 17, 2017 - 11:20 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

 

Hi

I mean, how does it work? In my android apk. I can discover samb11 and once  I am connected (Tera Term message "connected to peer device with address) then on the serial port that message "Fail  to start discover characteristic" pop up. I think the problem is with the characteristic value that I am trying to send. I do not know what actually need be send to tell samb11 that I am trying to connect. Only what I know is that the service_uuid and characteristic_uuid is defined in atmel studio serial chat code. as you can see I am sending a string of character (value->global array) defined as a global where array is 128bit number (FD5ABBA0-3935-11E5-85A6-0002A5D5C51B​).is that right or it suppose to be something different like from the previous comment the value should be a frame of this: (app_csc_info.csc_desc.conn_handle, app_csc_info.csc_desc.desc_handle, 0, 2, data, false, true​)?If so, then what  are these two first bits? The last block in my apk "when send click" fires up the function form post #4 but obviously doesn't work as samb11 doesn't recognise a char...value from previous  block?? any idea what I suppose to do?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

Hi marpan70

have you managed the communication to samb11 ? I mean the write property..

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi

Does anyone can explain this function and how to send or tell to the  samb11 that I want to send a data from the mobile apk.

at_ble_status_t csc_prf_write_notification_handler(void *params)
{
 uint8_t data[2] = {1, 0}; 
 DBG_LOG("\r\n");
 if(at_ble_characteristic_write(app_csc_info.csc_desc.conn_handle, app_csc_info.csc_desc.desc_handle, 0, 2, data, false, true) == AT_BLE_FAILURE){
  DBG_LOG("\r\nFailed to send characteristic Write Request");
 }

 return AT_BLE_SUCCESS;
}

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In the meanwhile I have made an application and I add the write property , and now I can send also data to the SAMB11 from my Smartphone app.

serv->serv_chars.properties = (AT_BLE_CHAR_READ | AT_BLE_CHAR_NOTIFY | AT_BLE_CHAR_WRITE ); /* Properties */

I use the AT_BLE_CHARACTERISTIC_CHANGED event to get the data.

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi marpan70,

 

i have tried adding the write profile in my code but it still shows notify profile

can you elaborate more on how you used the above provided write property in your code.

 

My SAMB11 shows only notify profile.but i want to write data from my android app to the SAMB11.

 

I am using CSC code for my application, in the function

 

at_ble_status_t csc_serv_init(uint8_t *buf, uint16_t len) 

 

i have added for the line   csc_inst.endpoint_chars.properties = (AT_BLE_CHAR_READ | AT_BLE_CHAR_NOTIFY | AT_BLE_CHAR_WRITE);

 

but still only notify profile is available, please suggest some solution.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello Friends,

Can anyone tell me where i can get OTAUImageCreator.exe for Samb11 MR Xplained Pro.

 

OTAU Application for ATSAMB11 - This application generates the image files for both the factory version and the upgraded version. The OtauImageCreator command line tool is used to generate both the factory format .img and the OTAU binary format (.bin) files. This tool is available as part of the BluSDK SMART package.

The command line tool OtauImageCreator.exe available in the BluSDK SMART package is used to create the factory format firmware image from the application executable file. The metadata corresponding to the application firmware such as firmware version, vendor and product identification, and hardware revision are provided in the factory_img.conf configuration file. The template of the factory_img.conf file is provided along with OtauImageCreator tool. The following figure shows the help content available in the OtauImageCreator tool. 

This is what i found in Blusdk smart otau document.

 

But i don't the path of  OTAUImageCreator.exe and  factory_img.conf file.

If anyone Knows update me.

Shiva

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

shiva_desai wrote:

Hello Friends,

Can anyone tell me where i can get OTAUImageCreator.exe for Samb11 MR Xplained Pro.

 

OTAU Application for ATSAMB11 - This application generates the image files for both the factory version and the upgraded version. The OtauImageCreator command line tool is used to generate both the factory format .img and the OTAU binary format (.bin) files. This tool is available as part of the BluSDK SMART package.

The command line tool OtauImageCreator.exe available in the BluSDK SMART package is used to create the factory format firmware image from the application executable file. The metadata corresponding to the application firmware such as firmware version, vendor and product identification, and hardware revision are provided in the factory_img.conf configuration file. The template of the factory_img.conf file is provided along with OtauImageCreator tool. The following figure shows the help content available in the OtauImageCreator tool. 

This is what i found in Blusdk smart otau document.

 

But i don't the path of  OTAUImageCreator.exe and  factory_img.conf file.

If anyone Knows update me.

 

http://ww1.microchip.com/downloa...