This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC1312R: Possible structures of pQueue. Can it be something other than a pointer to a struct of pointers.

Part Number: CC1312R

Hi,

I have a few questions about the pQueue field of CMD_PROP_RX. I would like the received packets to be copied to a static buffer which is copied out of kernel space into application space (a construct of the OS I am using). Unfortunately, the pointer to a structure of pointers object which is used in TI's example code is not something which can be safely implemented in the language I am using, Rust. I can create this structure but the radio mcu is faulting with `INTERNAL_ERROR` when I pass a pointer to the struct of pointers.

What exactly is the radio mcu doing with the pQueue field when it reads the given pointer? Does it copy the entire received message contents into the buffer pointed to by *pCurrentEntry? Or something else? I will be able to give the radio mcu a structure it recognizes if I know more about how it operates on this field.

Best,

Robert

  • Hello Robert,

    All you are passing a pointer. It is an address value, this value points to the location of first element of the packet.
    pQueue is a pointer that points to the address of first element, this queue is basically a circular buffer that holds the location of incoming packets.

    I hope this helps.

    Regards,
    AB
  • Thanks AB,

    I have made some changes and now I am receiving a 0x3801 error from the Radio MCU. The buffer which the current entry pointer is pointing to is definitely large enough for my test TX packet and I am wondering if I should be initializing a queue via an Immediate command before passing the queue struct to the radio? Is there a way to bypass using the queue structure and simply output to a pre-allocated buffer? The code included below is what I am using to create my data queue struct which pQueue points to. This is written in Rust and should be virtually identical to the queue constructed in the TI example code.

    pub struct DataQueue {
        pub p_curr_entry : *mut u8,
        pub p_last_entry : *mut u8,
    }
    
    impl DataQueue {
        pub fn new(curr_entry: *mut u8, next_entry: *mut u8) -> DataQueue {
            DataQueue {
                p_curr_entry: curr_entry,
                p_last_entry: next_entry,
            }
        }
    
        pub unsafe fn define_queue(
            &mut self,
            mut buf : *mut u8,
            buf_len : u16,
            num_entries : u8,
            length : u16
        ) {
            if buf_len as (u32) < num_entries as (u32) * (length as (u32) + 8 + (4 - (length as (u32) + 8) % 4)) {
                debug!("LEN ERROR");
                return;
            }
            else {
                let pad: u8 = (4i32 - (length as (i32) + 8i32) % 4i32) as (u8);
                let first_entry: *mut u8 = buf;
                let mut i: u32;
                i = 0;
                while i<num_entries as u32 {
                    buf = first_entry.offset((i * (8 + length as (u32) + pad as (u32))) as (isize));
                    (*(buf as (*mut dataEntry))).status = 0;
                    (*(buf as (*mut dataEntry))).config.d_type = 0;
                    (*(buf as (*mut dataEntry))).config.len_sz = 0;
                    (*(buf as (*mut dataEntry))).length = length;
                    (*(buf as (*mut dataEntryGeneral))).p_next_entry = (&mut (*(buf as (*mut dataEntryGeneral))).data as (*mut u8))
                        .offset(length as (isize)).offset(pad as (isize));
                    i = i + 1;
                }
                (*(buf as (*mut dataEntry))).p_next_entry = first_entry;
                self.p_curr_entry = first_entry;
                self.p_last_entry = 0i8 as *mut u8;
                READENTRY = first_entry as (*mut dataEntryGeneral);
            }
        }
    }
    

  • Hello Keith,

    Checking back in to see if you were able to resolve this issue.

    We have been taking longer to get back to you since you are using rust and this uses another compiler we do not support.

    Regards,
    AB
  • Hi AB,

    Thanks for responding. I was able to resolve the issue. Actually the data structure was correct but I overlooked the typedefs for these queue structures and that there is a default value used because it is not previously set when defining the queue. Defaults in rust are implemented separately where they can be defined within the typedef in C.

    Thanks,
    Robert