Hi all,
I'm working now on the DA14580 BLE module with SDK 5.0.4 and I can't send 0 via arch_printf command.
When sending 0, the FW jumps to hardfault_handler.c file to line 141 and stay there.
if ((GetWord16(SYS_STAT_REG) & DBG_IS_UP) == DBG_IS_UP)
__asm("BKPT #0\n");
any help will be great.
Keywords:
Device:
Hi YehudaNovodes,
I tried to replicate the issue that you have mentioned but I am able to send “0” via arch_printf(). I worked on the ble_app_barebone example of the SDK 5.0.4 and I used the Pro-DK. Let me describe what I did and make sure that you have done the same configurations.
#elif HW_CONFIG_PRO_DK
#define UART2_TX_GPIO_PORT GPIO_PORT_0
#define UART2_TX_GPIO_PIN GPIO_PIN_4
#define UART2_RX_GPIO_PORT GPIO_PORT_0
#define UART2_RX_GPIO_PIN GPIO_PIN_5
If you have one other of our DKs or if you are working on a custom board, please modify the definitions above with the appropriate GPIOs
If I understood anything wrong, please let me know what you are trying to accomplish or provide me hot to call the arch_printf() into your code.
Thanks, PM_Dialog
Sorry for not being clear enough.
Yes, I can send 0 via arch_printf.
The problem is when I'm trying to echo the input over UART. If one of the bytes inserted was 0x00, then when I'm trying to print the elements of an array that holds this byte, I get this error. I believe the reason is that 0 does not consider as a "value", so when I'm trying to print it, it can't find something to print and hence the error.
I checked the issue a bit more and I think I'm sure what is the problem now.
I use the arch_printf function to print an array. So if, for example, the content of the array is:
ExampleArr[2] = {0x01, 0x02};
and I'm trying to run:
arch_printf (ExampleArr);
the print out is 01, 02 which is exactly what I want. The problem starts when the first element of ExampleArr is 0x00, then the SW runs into
if ((GetWord16(SYS_STAT_REG) & DBG_IS_UP) == DBG_IS_UP)
__asm("BKPT #0\n");
error.
If the second element is 0x00 there's no problem.
When I'm trying to use arch_printf to print 0 like this:
ExampleVar = 0;
arch_printf("%x", ExampleVar);
there's no error but what's actually printed is the ASCII value of 0, which is 30. I need the 0 value to be printed, not the symbol...
Hi YehudaNovodes,
Could you please try this code snippet?
uint8_t ExampleArr[3] = {0x00, 0x01 , 0x02};
for( uint8_t i = 0 ; i <3 ; i++)
{
arch_printf("%x",ExampleArr[i]);
}
arch_printf("\n\r");
Otherwise, please provide me your code snippet as you are using it into your firmware.
Thanks, PM_Dialog
Hi,
As I mentioned, the arch_printf function gets the array to print by address arch_printf(ExampleArr) and not by value arch_printf(ExampleArr[i]). To be more clear, if I have a variable called ExampleVar = 0x01, then writing arch_printf (&ExampleVar) ends up with 1, printed on terminal but if ExampleVar = 0x00, the arch_printf(&ExampleVar) ends up with error!!
The reason I'm not using your way is that the value printed out is NOT the actual value but its ASCII compatible. So, if I'll return to my previous example, this is how it looks in both cases:
1)
ExampleVar = 0x01;
arch_printf(&ExampleVar);
Print out is: 1
ExampleVar = 0x00;
arch_printf(&ExampleVar);
Print out is: error
2)
ExampleVar = 0x01;
arch_printf ("%x", ExampleVar);
Print out is: 31
ExampleVar = 0x00;
arch_printf ("%x", ExampleVar);
Print out is: 30
I really hope the problem is clear now...
Hi YehudaNovodes,
Apologies for the delay. I tried to test your code, this code snippet arch_printf(&ExampleVar) cannot be built by the Keil. This is a quite strange situation, because if I understood correctly this can be built from your side. Also, I have different results than yours. Please check the following:
ExampleVar = 0x01;
arch_printf ("%x", ExampleVar);
Print out is: 1 (and NOT 31 which is the ASCII character of 1)
ExampleVar = 0x00;
arch_printf ("%x", ExampleVar);
Print out is: 0 (and NOT 30 which is the ASCII character of 0)
Could you please let me know if you have modified the source code of the arch_printf() function? Could you please try to do the same in a new SDK path? Be aware that I am using the latest SDK of D14580 series (SDK5.0.4)
Thanks, PM_Dialog
Hi,
No, I haven't modified your source code of arch_prinf at all.
But I have a better solution. For printing an array of any value at any location, I just used the uart2_write(*arr, Size, NULL) function, when *arr is the pointer to the printed array, Size is the size to be printed, in bytes, and NULL is the NULL pointer, as required in the description of the function.
Hi YehudaNovodes,
Since that you didn’t modified the arch_prinf() function, it is a little bit strange because I get different results from yours. By the way, glad that you figured your issue out and that for your indication.
Thanks, PM_Dialog
Dear forum experts,
我工作在DA14580 the sdk5.0.4.
I want to know How does the host receive SMP requests from the slave.
I had run my code,attach below,sniff the slave but there's no CALLBACK in the user functions.
it seems it was invalid?
How does the host receive SMP requests from the slave?
Thanks in advcance,
Dionysus
Hi Dionysus,
Thanks for your question but it is not related with this forum thread. If I understood correctly the DA14580 is acting as a central. Since you are a central, you cannot request security from a peripheral. If you have any other follow-up questions, please create a new forum thread. If you don’t know hot to create a new forum thread, please let me know and I will provide you the appropriate steps.
Thanks, PM_Dialog
Hi YehudaNovodes,
you might try my code which can send hex, as follows:
extern void uart_callback(uint8_t res);
uint8_t data=0x00;
uart2_write(&data, 1, uart_callback);
Hi chenpenglai,
Thanks for your indication.
Regards, PM_DIalog