Tool/software: TI C/C++ Compiler
Hello!
I have 2 problems and asks for help.
The first problem i have - is a problem with a malloc function in my project based on simple peripheral.
This screenshot contains memory allocation of project. So i have about 7k ram
But when i try to allocate a 2048 bytes buffer using malloc - cc2640r2 just hangs.
So i think that the heap size is small - is it possible to make it bigger? in app_ble_m3 file defines heap function 0x80.
And the second problem is the spi problem -
This is how i define hardware pins, and then i do
volatile static PIN_Id chipselect_main;
bool ll_spi_init( PIN_Id chipselect, spi_device_e device_type )
{
bool result = false;
SPI_Params params = { 0 };
SPI_init();
switch (device_type)
{
case SPI_DAC:
SPI_Params_init(¶ms);
params.bitRate = 400000;
params.dataSize = 16;
params.frameFormat = SPI_POL0_PHA1;
params.mode = SPI_MASTER;
break;
case SPI_FLASH:
SPI_Params_init(¶ms);
params.bitRate = 100000;
params.dataSize = 8;
params.frameFormat = SPI_POL1_PHA1;//SPI_POL1_PHA1;
params.mode = SPI_MASTER;
break;
default:
break;
}
spiHandle = SPI_open(SPI_BUS_NUM, ¶ms);
if (spiHandle != NULL) {
result = true;
}
chipselect_main = chipselect;
SPI_control(spiHandle, SPICC26XXDMA_SET_CSN_PIN, &chipselect_main);
return result;
}
If i do this instantly after i2c init
bool ll_i2c_init( void )
{
bool result = false;
I2C_Params params = {0};
I2C_init();
I2C_Params_init( ¶ms );
params.bitRate = I2C_100kHz;
i2cHandle = I2C_open( I2C_BUS_NUM, ¶ms );
if (i2cHandle != NULL) {
result = true;
}
return result;
}
then i sometimes have problems - cc2640r2 hangs too:(
and not instantly after spi open.
Best regards, Dmitrity.


