MKW30Z; BLE connect multiple devices with same MAC

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MKW30Z; BLE connect multiple devices with same MAC

2,533 Views
lucianfiran
Contributor V

SDK1.3; IAR 7.50;  KW40Z_Connectivity_Software_1.0.1 (KSDK_1.3.0)

In the scenario that there are multiple MKW30Z containing devices

and there is a  need to connect them as groups to the same smartphone.

On the embedded devices GAP Peripheral and GATT Server is used.

 

Should any changes made in advertising data on individual devices ?

Where should these differences be treated phone (iOS, Andorid) or MKW30Z device ?

What possible solution there are and  what is the best approach ?

Labels (1)
9 Replies

1,477 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Lucian,

As you know the MAC address is a unique number, so we don not recommend do that.

You have to made changes for the advertising data, you can't use the same address for multiples devices.

In the case that you connect a device with a phone, it will save information about the aplication, MAC address, service,etc. then you connect other device with the same MAC to the phone, it will take time to update and follow the process to connect a device.(The first device is shut down, the both applications do not have security).

If the application has security the phone will reject the connection.

Hope it helps

Best Regards,

Mario

1,477 Views
lucianfiran
Contributor V

So best solution is to have unique MAC addresses.

I think MAC is codded on below define inside app_preinclude.h

#define BD_ADDR             0x13,0x00,0x00,0x9F,0x04,0x00

Can I use some chip serial number or signature to get some unique address ?

What about NXP OUI with some chip signature SS ?

MM:MM:MM:SS:SS:SS

Organizationally Unique Identifier is a 24-bit number that uniquely identifies a vendor or manufacturer.

http://standards-oui.ieee.org/oui.txt 

like

AC-9A-22   (hex)        NXP Semiconductors
AC9A22     (base 16)        NXP Semiconductors
                411 E. Plumeria Drive
                San Jose  CA  95134
                US

00-60-37   (hex)        NXP Semiconductors
006037     (base 16)        NXP Semiconductors
                High Tech Campus 32, Office 1.21
                SAF  AD  13456
                NL

E0-51-24   (hex)        NXP Semiconductors
E05124     (base 16)        NXP Semiconductors
                411 E. Plumeria Drive
                San Jose  CA  95134
                US

--------------------

Got confused by these settings:

  file gap_types.h it seems that I can choose some random address.

typedef struct gapAdvertisingParameters_tag {

.......

    bleAddressType_t                    ownAddressType;         /*!< Indicates whether the advertising address will be the public address (BD_ADDR) or the random address (set by Gap_SetRandomAddress). Default: public address. */

typedef struct gapScanningParameters_tag {

..........

    bleAddressType_t            ownAddressType;     /*!< Indicates whether the address used in scan requests will be the public address (BD_ADDR) or the random address (set by Gap_SetRandomAddress). Default: public address. */
 

typedef struct gapConnectionRequestParameters_tag {

.....

    bleAddressType_t            ownAddressType;         /*!< Indicates whether the address used in connection requests will be the public address (BD_ADDR) or the random address (set by Gap_SetRandomAddress). Default: public address. */

found in ble_general.h

/*! Bluetooth Device Address Types */
typedef enum {
    gBleAddrTypePublic_c            = 0x00,     /*!< Public Device Address - fixed into the Controller by the manufacturer. */
    gBleAddrTypeRandom_c            = 0x01      /*!< Random Device Address - set by the Host into the Controller for privacy reasons. */
} bleAddressType_t;

and set in app_config.c

gapAdvertisingParameters_t gAdvParameters =
{ \
.............
    /* addressType */         gBleAddrTypePublic_c, \
    /* directedAddressType */ gBleAddrTypePublic_c, \

Thank you, and

Best Regards,

Lucian

0 Kudos

1,477 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Lucian,

The OUI is 00049F Freescale. company_id

Remember you have two options for select the BD_ADDRESS, public and random.

/*! Bluetooth Device Address Types */
typedef enum

{
   gBleAddrTypePublic_c = 0x00, /*!< Public Device Address - fixed into the Controller by the manufacturer. */
   gBleAddrTypeRandom_c = 0x01 /*!< Random Device Address - set by the Host into the Controller for privacy reasons.*/
} bleAddressType_t;

If you select Public address, you will send universal LAN MAC addresses and using a valid Organizationally Unique Identifier (OUI) obtained from the IEEE Registration Authority.

pastedImage_5.png

The random device address may be of either of the following two sub-types, privacy reasons:
• Static address

pastedImage_1.png


• Private address.

   The private address may be of either of the following two sub-types:
      -Non-resolvable private address

pastedImage_2.png
      -Resolvable private address

pastedImage_3.png

Hope it helps,

Mario

1,477 Views
lucianfiran
Contributor V

Hello Mario,

Bluetooth MAC address differs from WI-FI MAC ?

MAC address - Wikipedia

MAC-48 Address.svg

in wiki - public / private bits differ as position.

Can we use 16 bit  SIM_UIDMH  + 32bit SIM_UIDML  + 32bit SIM_UIDL (total 80bit) as a unique chip depended key -  Unique Identification Register - to generate a Random Static address ?

pastedImage_7.png

pastedImage_8.png

pastedImage_9.png

MKW40Z/30Z/20Z Reference Manual, Rev. 1.2, 10/2015

Thank you,

Best Regards,

Lucian

0 Kudos

1,477 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Lucian,

You can use that register o generate Random Static address.

Remember:

The BD_ADDR may take any values except the 64 reserved LAP values for general and dedicated inquiries

 

Reserved Addresses

A block of 64 contiguous LAPs is reserved for inquiry operations; one LAP common to all devices is reserved for general inquiry, the remaining 63 LAPs are reserved for dedicated inquiry of specific classes of devices The same LAP values are used regardless of the contents of UAP and NAP. Consequently, none of these LAPs can be part of a user BD_ADDR. The reserved LAP addresses are 0x9E8B00-0x9E8B3F. The general inquiry LAP is 0x9E8B33.

You can take a look for the Specification of the Bluetooth System v4.2

Hope it helps

Mario

1,477 Views
lucianfiran
Contributor V

Hi Mario,

Found a presentation KINETIS W MCUS: BLUETOOTH® SMART AND THREAD
EBV FAE TRAINING - SITGES  16TH MARCH, 2016

on page 11

pastedImage_1.png

It states something about 40bit unique number for MAC, do you know something about this ?

Best Regards,

Lucian

0 Kudos

1,477 Views
lucianfiran
Contributor V

What about:

The RSIM MAC Address registers provide a unique ID that is stored in the Flash during factory test

The RSIM MAC Address is loaded from the Flash IFR during the SoC Power on Reset sequence. The MAC Address is a unique ID that is stored in the Flash during factory test.

RSIM_MAC_MSB 8bit RSIM_MAC_LSB 32bit

total 40bit

Address: 4005_9000h base + 8h offset = 4005_9008h
Address: 4005_9000h base + Ch offset = 4005_900Ch

page 988
Chapter 46 Radio System Integration Module (RSIM)
MKW40Z160RM  MKW40Z/30Z/20Z Reference Manual  Rev. 1.2, 10/2015
46.2.3 RSIM MAC MSB (RSIM_MAC_MSB)
46.2.4 RSIM MAC LSB (RSIM_MAC_LSB)

Can this be use as static private MAC address ?

pastedImage_4.png

0 Kudos

1,477 Views
lucianfiran
Contributor V

Hello Mario,

About current framework and MKW30Z  the gBDAddress_c is a const array:

app_preinclude.h
#define BD_ADDR             0x13,0x00,0x00,0x9F,0x04,0x00

ble_controller_task.c
/* Public Device Address */
const uint8_t gBDAddress_c[6] = {BD_ADDR};

If I want to use, let say, OTA_CrcCompute from OtaSupport.c

uint16_t OTA_CrcCompute(uint8_t *pData, uint16_t lenData, uint16_t crcValueOld)

to get 16bit form 80bit regs (SIM_UIDMH, SIM_UIDML, SIM_UIDL )

(or other CRC32 or hash function)

pastedImage_7.png

 can I modify gBDAddress_c to be not constant ?

Best Regards,

Lucian

0 Kudos

1,477 Views
lucianfiran
Contributor V

Hi Mario,


Public address  - IEEE registered, will never change during the lifetime of the device
48bit
  b0  -> b23 company assigned
  b24 -> b47 company id  
the  b46 b47 should be different from 11, 00 and 10 - correct ?

As third party using NXP chips can we use FSL or NXP OUI ?


Random Static address - generated every time the device boots up or can stay the same for the lifetime of the device.
 - cannot be changed within a single power cycle of the device.
48bit
  b0  -> b23 random part of static address
  b46 b47  -> 11


MKW30Z has a Random Static Address registers unique for each device - found inside some chip register ?

As chips are provided by NXP, there is a link between the individual chip SN and a generated unique static MAC ?
Is this implemented / supported  in current framework ?

KW40Z_Connectivity_Software_1.0.1 (KSDK_1.3.0)


Private Resolvable address -  generated from an identity resolving key (IRK) and a random number
can be changed often even during the lifetime of a connection
Is this implemented in current framework, you need some paring or extra security settings ?


Private Non-Resolvable address.
Not very commonly used, a random number that you can change anytime.
Is this implemented in current framework ?

The random static device address is also supported by iOS and Android (or Win 10) systems ?


References:
https://devzone.nordicsemi.com/question/39375/bluetooth-address-built-in-or-random/
https://devzone.nordicsemi.com/question/6496/gap-address-types/ 

Private vs public addresses in Bluetooth low energy on Android - Stack Overflow 

Thank you,

Lucian

0 Kudos