Skip to main content
apronin47
Associate II
May 6, 2019
Question

Working MESH network without a smartphone

  • May 6, 2019
  • 10 replies
  • 2684 views

I am trying to implement a working MESH network without the participation of a smartphone. The idea is to send messages from all test nodes to one specific node through the MESH, which has the same hardware structure as the rest. This node should process the incoming message and perform some actions with its peripherals. Is it possible? Please advise how best to implement it.

Which profile is better to choose for the model on-off? Please, advise what I should pay attention to.

This topic has been closed for replies.

10 replies

Winfred LU
ST Employee
May 7, 2019

Hi apronin47,

Yes, it is possible.

Something similar has been implemented in Mesh DK that you may reference:

when the user click (short press) button 1 or 2 (in Appli_Process()),

the firmware will publish a message to other nodes in the mesh network (in Appli_ShortButtonPress() and BluenrgMesh_ModelsCommand()).

For model choices, Generic On-Off is a good one, vendor specific model is also OK.

Best Regards,

Winfred

Anitha
Associate III
May 7, 2019

Sir but for publish those messages in the other nodes we have to provision those nodes with app right

Winfred LU
ST Employee
May 8, 2019

Yes. Those are all based on the assumption that the nodes are provisioned in the mesh network.

apronin47
apronin47Author
Associate II
May 7, 2019

Hi Winfred,

Thank you for your reply.

Sorry for I am not so friendly with MESH. Please help me with some other issues.

  • How can I set specific node as addressie for messages from other nodes without configuration by a smartphone application?
  • I have PCB's with BNRG-232 inside. BNRG has different pin configuration as it set in evaluation board. So I must change pin configuration gave in example project. Where have I make changes for this task? I guess best way is to create header file as "USER_Platform_Configuration_***.h" and add it to my project, excluded from project "USER_Platform_Configuration_STEVAL_IDB007V1.h".
  • Where should I set model choise?
  • I use PCB's with battery supply as nodes for MESH. I'v planed that every twenty seconds all nodes should wake up for publishing message for main node. And after this activity period MESH will sleep for next twenty seconds, and so on. Please share your opinion for my approach.

Best Regards,

Andrey

Winfred LU
ST Employee
May 8, 2019

Hi Andrey,

The parameter "peer" is to set destination address for BluenrgMesh APIs, such as BluenrgMesh_SetRemoteData(), BluenrgMesh_ReadRemoteData(), etc.

It shall be good to just use publish address, please call BluenrgMesh_GetPublishAddress() to get the publish address of a node.

Yes for USER_Platform_Configuration.h

please refer to the procedures in SDK_EVAL_Config.h:

  1. Create a file "USER_Platform_Configuration.h" with specific user  platform configuration (USER_Platform_Configuration_STEVAL_IDB007V1.h can be used as reference).
  2. Place the "USER_Platform_Configuration.h" on the SDK_Eval_BlueNRG1\inc folder. 
  3. In your IDE preprocessor options, add this define:  USER_DEFINED_PLATFORM=USER_EVAL_PLATFORM

Please pre-define your own model choice and use corresponding APIs.

Please implement your application in Appli_Process(). For your ease of usage, please leverage the general purpose timer library (gp_timer.c) to calculate the expiration of 20 seconds.

Note that even if the application acts at each 20 seconds, it is necessary for the device to wake during the 20 seconds (when application sleeps), in order to keep BLE stack and Mesh stack working. The processing APIs BluenrgMesh_Process() and BluenrgMesh_ModelsProcess() have to be kept in the main loop.

Best Regards,

Winfred

apronin47
apronin47Author
Associate II
May 8, 2019

Hi, Winfred!

Thank you for your explanations.

I shall use "generic on/off" model so I have associated question for this.

I guess "mesh_cfg_usr.h" is the place where I can make model choice for "#define ENABLE_GENERIC_MODEL_SERVER_ONOFF ". And as I think all other models should be commented. Am I right?

Best regards,

Andrey

alok
Visitor II
May 9, 2019

Right !

apronin47
apronin47Author
Associate II
May 16, 2019

Hi Winfred!

In my project I use the "i2C1" interface. When I compile, I get the following error:

".. \ .. \ .. \ .. \ .. \ .. \ Drivers \ BSP \ SDK_Eval_BlueNRG1 \ src \ SDK_EVAL_I2C.c (575): error: # 20: identifier" SDK_EVAL_I2C_IRQ "is undefined"

How do I need to modify the "USER_Platform_Configuration.h" file to resolve this error?

Best regards,

Andrey

Winfred LU
ST Employee
May 17, 2019

Please try to define SDK_EVAL_I2C_IRQ I2C1_IRQn

apronin47
apronin47Author
Associate II
May 17, 2019

Hi Winfred!

Thanks for your help.

At the moment I have no problems with the compilation and linking of my project in Keil IDE.

Best regards,

Andrey

apronin47
apronin47Author
Associate II
May 20, 2019

Hi Winfred and alok!

Unfortunately, I'v got some problems with the module.

I suppose that the reason for the error pointed to by Keil. May be with this trouble debugger stops in "UART_Handler(void) {}"0690X000008w94sQAA.jpg

Is there some solution with your opinion?

Best regards,

Andrey

Winfred LU
ST Employee
May 21, 2019

It shall be fine.

The Keil error says that the string "Bad BD_MAC_ADDR!\r\n" is not a valid token for the "##" preprocessor, which shall not matter here.

But in case it is really concerned, i think it might be OK to modify the marcros in mesh_cfg_usr.h (line 63):

#define TraceC0(...)
#define TraceC1(...) do { printf( __VA_ARGS__);} while(0)
#define TraceCX(flags, ...) TraceC##flags( __VA_ARGS__)
#define TRACE_I(flag, ...) TraceCX(flag, __VA_ARGS__)

apronin47
apronin47Author
Associate II
May 21, 2019

Hi Winfred!

You were right. Although the changes made led to the elimination of the preprocessor error, the problem remained. It consists in the fact that the "printf" function displays only four characters. After that, the program hangs in this function and no longer goes. TRACE_I behaves similarly.

0690X000008wCawQAE.jpg

Unfortunately, I can’t find a place where the “printf�? output is redirected to UART. Since uKeil does not find a place to redefine the flow from the stdout to the Uart.

Best regards,

Andrey

Winfred LU
ST Employee
May 22, 2019

Hi Andrey,

The system was interrupted by another event.

Please try to debug with an ST-Link, back trace the call stack to figure out the "place".

Best Regards,

Winfred

apronin47
apronin47Author
Associate II
May 22, 2019

Hi, Winfred!

Thanks for the answer. I received the correct response from the PCB using the debugger.

However, there are some features.

The fact is that I managed to get the correct response only in the uKeil debugger mode. I do it like this.

I launch the debugger for execution before the second printf command. Then I press the stop button in the debugger.

Then I put the cursor on the position of the working cycle

/* Main infinite loop */ and again start debugging.

And only after this, I get the correct response from the PCB which can be seen in the picture.

If I just reset the PCB, the board does not work and does not output anything to the UART.

Accordingly, I do not see the activity of the board in the application on the smartphone. Please help solve this problem.

Best regards,

Andrey0690X000008wH0GQAU.jpg

Winfred LU
ST Employee
May 23, 2019

Hi Andrey,

Please try in Debug Session press 'F5' to run for a while, then break MCU.

Possibly it is in some exception handler. Then you'll be able to backtrace the stack and check how it occurred.

Best Regards,

Winfred

apronin47
apronin47Author
Associate II
May 23, 2019

Hi Winfred!

Thanks for the answer in my topic. Hope you are well.

I found that the reason for the incorrect work of the program was the discrepancy between the assignment of pins for the UART and the PWM. Sorry for my hasty questions in the past.

I hope that further problems will not arise.

Best regsrds,

Andrey

Winfred LU
ST Employee
May 28, 2019

Hi Andrey,

Good to know it works.

The debugger did provide clues:

when the issue occurred, it looped when checking UART TXFF (TX FIFO full) flag.

It means something wrong with the hardware (in your case, GPIO mode configuration) so that BlueNRG-2 was not able to transmit to UART.

static void SdkEvalUart_Send_Data(uint8_t tx_data)
{
 /* Wait if TX fifo is full. */
 while (UART_GetFlagStatus(UART_FLAG_TXFF) == SET);
 /* send the data */
 UART_SendData(tx_data);
}/* end SdkEvalUart_Send_Data() */

Best Regards,

Winfred