SbcUJA1169x driver.c code

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SbcUJA1169x driver.c code

782 Views
Ashish4525
Contributor II

Dear All

I was looking for an example code for UJA1169 in s32ds and I have found for s32k142evb board.

But I think you should check once the code line which I am sharing line(1627) 

while compiling it shows error in Command because it is const,so how in code it is getting modify.

status_t SBC_DataTransfer(const sbc_register_t regName,
const uint8_t* const sendData, uint8_t* const receiveData)
{

status_t status = STATUS_SUCCESS;

const uint8_t command[2] = {0U, 0U};
uint8_t readOnlyMask = 0x00U;
uint8_t readData[2] = {0U, 0U};

/* Test if there is data for sending. */
if(sendData == NULL)
{
/* This transfer is read only. */
readOnlyMask = 0x01U;
command[0] = 0U;
}
else
{
command[0] = *sendData;
}

/* Address of device with read only bit. */
command[1] = (uint8_t)((SBC_UJA_REG_ADDR_F(regName) | readOnlyMask) & 0xFFU);

status = LPSPI_DRV_MasterTransferBlocking(g_drvConfig.lpspiIntace, command,
readData, 2U, SBC_UJA_TIMEOUT );

if( readData[1] != command[1])
{
status = SBC_COMM_ERROR;
}

/* Copy content of register to receive data. */
if(receiveData != NULL)
{
*receiveData = readData[0];
}

return status;
}

Note: if( readData[1] != command[1])
{
status = SBC_COMM_ERROR;
}      

Due you think readDATA[1] will ever be equal to command[1] because in my case it is always SBC_COMM_ERROR.

I have S32k118evb so I have taken only UJA1169driver..So can you run this code and flash on s32k142 to check whether this code is running fine or not .

I am Using S32k118evb which have inbuilt UJA1169TK so can I use this code sbc part for flashing.

PFA images for more clearity

B.R

Ashish

0 Kudos
Reply
3 Replies

736 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

Hi Ashish,

Based on your screenshot, there is no "const uint8_t command[2]" inside the DataTransfer function in the K1 SDK 4.0.3 used. Note that during the whole time that the driver was developed (2016-2021) it was never there, so there must have been an error somewhere, I do not know how such a code got into the Design Studio. I suppose it was added there by mistake.

1.png

BRs, Tomas

 

0 Kudos
Reply

733 Views
Ashish4525
Contributor II

Hi Tomas

Can you provide me Uja1169 code so that I can use it for S32k118evb.

I have taken this code from s32ds3.4

Can you provide me updated one.

B.R

Ashish 

0 Kudos
Reply

748 Views
Ashish4525
Contributor II

Dear all

I am waiting for your support and response.

B.R

Ashish 

0 Kudos
Reply