Hi dialog,
I am using DSPS example,I met a problem hope you can help.
I used a timer to read data via spi about 1s a time, but it stops after 5 or 6 times reading(page1 in attached), and after another 10s , the program fails(page2).
can you help to analyse why?
The example I use is dsps_device, maybe the uart intrupt conflict with spi? if so, how to stop uart?
Thanks
Benjamin
Keywords:
Device:
Hi BenjaminDu,
Τhe platform_reset_func() is invoked by the platform_reset(), which is implemented ROM code. The most possible reason why you get this assertion is due to insufficient memory, because you might try to allocate messages that you never consume. For example, if you are allocating notification messages and you have a small connection interval the messages are piled up until a connection event arrives, but with a large connection interval your run out of memory before the connection event arrives.
Thanks, PM_Dialog
Hi dialog,
Thanks a lot for your quick reply.
My code as in the attached, there seems no unconsumed data.
I still think spi i conflicts with uart
as uart has no use in my project,
can you help to tell me how to stop it? then I can test if uart conflicts with spi.
Thanks
(I test spi in other example, it works well)
l think spi_trabsanction is the only reason result in the conflict
Thanks
Benjamin
Hi BenjaminDu,
Is the device booting from flash or from System-RAM? Are you continuously interacting with the UART? I will try to replicate it. If you could share with me the modifications you have done, it would be very helpful.
Thanks, PM_Dialog
Hi dialog,
Boot from system, there is little interact between uart
My major modification as following
void timer_callback(void)
{
int iSSS;
iSSS=spi_transaction(0x80040001);
//iSSS=(iSSS>>5)&0xFFFF;
//iSSS/=64;
//iSSS=1023;
arch_printf("TTTTT\t");
}
#ifdef CFG_PRINTF_UART2
GPIO_ConfigurePin( 2, 8, OUTPUT, PID_UART2_TX, false );
GPIO_ConfigurePin( 2, 9, INPUT, PID_UART2_RX, false );
#endif
GPIO_ConfigurePin( 0, 0, OUTPUT, PID_SPI_CLK, false );
GPIO_ConfigurePin( 0, 2, OUTPUT, PID_SPI_EN, true );
GPIO_ConfigurePin( 0, 5, INPUT, PID_SPI_DI, false );
GPIO_ConfigurePin( 0, 6, OUTPUT, PID_SPI_DO, false );
SPI_Pad_t spi_CS_Pad;
spi_CS_Pad.pin = 2; //2 or
spi_CS_Pad.port =0; // SPI_PORT;
spi_init(&spi_CS_Pad, SPI_MODE_32BIT, SPI_ROLE_MASTER, SPI_CLK_IDLE_POL_LOW, SPI_PHA_MODE_0, SPI_MINT_DISABLE, SPI_XTAL_DIV_8);
timer_init();
timer0_register_callback(timer_callback);
The output as following, then it stops, about 15s, it fails. attached is the whole doc that modified.
SPSS Init
TTTTT other msgid 3328
TTTTT TTTTT TTTTT TTTTT TTTTT TTTTT
Hi dialog,
Total 4 documents modified,all in the above .pdf simply copy them and paste into the corresponding doc, then you can test it.
Thanks a lot for you help
Benjamin
2019.10.17
Hi BenjaminDu,
The platform_reset_func() is due to insufficient memory, so can you please try to increase the heap size by defining the DB_HEAP_SZ in the da1458x_config_advanced.h header file?
Thanks, PM_Dialog
Hi dialog,
I increased DB_HEAP_SZ 2 times and 4 times, but still it crashes, the difference is the bigger size the DB_HEAP_SZ, the longer time it took to crash.
can you help to say where the memory is used?
Do you have other way to avoid crashing ?
Thanks
Benjamin
Hi dialog,
Previously I use SDK3.x uart_slave,DB_HEAP_SZ is 1024, still it works well, I shifted to new SDK as you suggest, but it crashes as the above shows, I think it's due to series port memory consumption, as the series port is not used in my project, can you help to suggest how to stop the series port?
Thanks
Benjamin
Hi dialog,
Maybe spi conflict with other interrupt?
as spi can work well independent ly.
Thanks
Benjamin
Hi BenjaminDu,
The problem is due to insufficient memory. Can you please summarize all the modifications you have done in order to replicate your issue? The DSPS has UART and BLE activity, so I am not very sure is this is achievable, because the system will run out of memory due to pending messages. Have you replicated in another SDK project?
Thanks, PM_Dialog
Hi Dialog,
Following 3 files modified:
arch_main.c
user_periph_setup.c
da1458x_config_basic.h
I copied the contents of the 3 files and their modifications in the PDF document, the 3 are separated by ///////////you can find the modifications where there is //Benjamin added.
I tested the same code with SDK3.x uart_slave, and it works.
Thanks
Benjamin Oct. 23rd.
Hi dialog,
My project is to use dsps to read throngh spi, I think it should be possible.
Thanks
Benjamin
oct 24th
Hi dialog,
can you give me a response?
Thanks
BenjaminDU Oct. 25
Hi dialog,
you said there are pending messages, can you please give example which message?
Thanks
BenjaminDU
任何人都可以告诉我e spi and at the same time,also can connect over ble?
Hi dialog,
The project I tested is dsps_device.uvprojx, the modified 3 files as attached
Thanks
Benjamin
Hi BenjaminDu,
You are not able to have UART and SPI activity at the same time. The ble_app_security example of the SDK uses SPI flash n order to store the bonding data. Please follow USER_CFG_APP_BOND_DB_USE_SPI_FLASH. In order to initialize and interact with SPI flash, I would suggest you to use our APIs. You can also take spi_flash example as a reference (6.0.10.511\projects\target_apps\peripheral_examples\spi). Can you please clarify which are your requirements with the DSPS and SPI flash?
You should use the app_easy_timer() API. Every time that the timer expired, the registered callback will be triggered, so you need to register the callback for interacting with SPI flash. Keep in mind that DSP uses extended sleep mode by default, so all the peripheral blocks including the SPI will be powered down.
Thanks, PM_Dialog
Hi BenjaminDu,
Just seen your attached modified file. I will try to test it in a clean sps_device project. Do you have a custom board, or you are using any of our DKs? Also, do you have another DA14585 running the sps_host firmware or you are using our DSPS mobile application to connect?
Thanks, PM_Dialog
Hi Dialog,
UART is not a must, I use UART to output data in a easy way to observer the code runing during debug, but I tested my code, if I don't use the UART to out put anything, still the program can crash, also in SKD3.x, I use slave_uart and master_uart example,UART works well with SPI.
I tested SPI_flash example, and it can interact with my SPI device well.
My requirement is to read data by SPI and send the data to a peer device(eith to mobile or sps_host)
Do you mean extended sleep mode will disable SPI? and SPI is stopped and maybe this is the reason why the program crashed?
Thanks
Benjamin
Hi Dialog,
Yes I'm using a customer board.
I use the sps_host firmware, and I can also use the mobile application , both of them can connect to the dsps_device
Hope you can have a test of my code and help me to found out where does the problem is.
Thanks
Benjamin
Hi Benjamin,
在睡眠模式下,所有包括外围的块ding I2C, UART, SPI are powered down. In DSPS example, the sleep mode is extended sleep mode by default. In case of UART, Hardware Flow Control is used in order to wake up the device when there are available data to sent or received. Can you please try it in active mode?
Thanks, PM_Dialog
Hi,
I tested active mode, and it seems works, I will do more tests to confirm it.
Thanks
Benjamin
Hi Benjamin,
The extended sleep mode was the issue because, as I mentioned in my previous answer, all the peripheral blocks are powered done in sleep mode.
Thanks, PM_Dialog