Unable to allocate a Pipe/Buffer in Driver internal Thread (ncs 2.2.0)

Hello,
I am currently developing a driver for the ADS1293 from Texas Instruments.

As there is no suitable API for a "EKG AD-Converter" i am not using any overlay API like the Sensor Api.
I am referencing the ADXL372 Interrupt Driven Driver as a Base for processing incoming Data via a Driver internal Thread.

My Problem as stated in the Title is that i cannot allocate a Buffer for a Pipe in the Driver internal Thread.

Im trying to Initialise a Pipe using the:

    int k_pipe_alloc_init(struct k_pipe *pipe, size_t size)

Function.
It Returns the -ENOMEM Error indicating that it cannot Allocate Memory for the Pipe

This problem also extends to allocating a Buffer on the Thread stack like so:
uint8_t isr_rx_buf [10];


The Project Config i use is

CONFIG_PIPES=y
#Enable Logging
CONFIG_LOG=y
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
CONFIG_USE_SEGGER_RTT=y
CONFIG_LOG_BACKEND_RTT=y
CONFIG_LOG_BACKEND_UART=n
CONFIG_ASSERT=y
#Enable SPI for ADS Chip
CONFIG_SPI=y
CONFIG_SPI_NRFX=y

#Sensor Specific Configs
CONFIG_SENSOR=y
CONFIG_SENSOR_LOG_LEVEL_DBG=y
CONFIG_ADS1293=y
#Custom Module
CONFIG_ADS1293_ENABLE_INTERRUPTS=y
CONFIG_ADS1293_DRDYB_INTERRUPT=y
CONFIG_ADS1293_ALARMB_INTERRUPT=y

Im building for a Costum Board Target based on the NRF53 specifically for the nrf5340_cpuapp_ns target


Any Help or Insight on how Kernel Threads and Stacks work in Zephyr would be greatly appreciated

The relevant Driver Snippets can be found here: ads1293_sample.rar
Please note that the Code is unoptimized and filled with LOG_DBG calls as i dont know exactly why it crashes.

Parents Reply
  • Hello,
    I have tried giving the Thread Stack more Resources but that didn't help.

    But i have just tried adding a Buffer like you said and that worked. I dont know exactly why it works now but all i changed was:

    1. Use the unsigned char __aligned(4) my_ring_buffer[100]; you suggested
    2. I Specifically didnt use the uin8_t Type, though this should not have an Effect as its the same as unsigned char.

    I can now also allocate a uint8_t Buffer.

    Thank you for your fast Reply and the Help.

    Regards,
    Nick

Children
No Data
Related