Comments (6)
It looks like you're using ST's HAL: https://www.disca.upv.es/aperles/arm_cortex_m3/llibre/st/STM32F439xx_User_Manual/group__can__exported__functions__group3.html#gaf25698a35af7f78d01b036fcb80d81f3
HAL_CAN_GetRxMessage
returns HAL_OK
if there was a message otherwise HAL_ERROR
.
Try this:
static enum Iso14229CANRxStatus mockClientCANRxPoll(uint32_t *arb_id, uint8_t *data, uint8_t *dlc) {
if (HAL_OK == HAL_CAN_GetRxMessage(&hcan1, CAN_RX_FIFO0, &rxHeader, TxData)) {
*arb_id = rxHeader.ExtId;
*dlc = rxHeader.DLC;
memmove(data,TxData,*dlc);
return kCANRxSome;
}
else {
return kCANRxNone;
}
}
from iso14229.
It looks like you're using ST's HAL: https://www.disca.upv.es/aperles/arm_cortex_m3/llibre/st/STM32F439xx_User_Manual/group__can__exported__functions__group3.html#gaf25698a35af7f78d01b036fcb80d81f3
HAL_CAN_GetRxMessage
returnsHAL_OK
if there was a message otherwiseHAL_ERROR
.Try this:
static enum Iso14229CANRxStatus mockClientCANRxPoll(uint32_t *arb_id, uint8_t *data, uint8_t *dlc) { if (HAL_OK == HAL_CAN_GetRxMessage(&hcan1, CAN_RX_FIFO0, &rxHeader, TxData)) { *arb_id = rxHeader.ExtId; *dlc = rxHeader.DLC; memmove(data,TxData,*dlc); return kCANRxSome; } else { return kCANRxNone; } }
Yes I am using ST's HAL. Thanks for response.
But whenever I want to debug code, mockClientCANRxPoll function is not triggered.
Iso14229Client udsClient;
struct Iso14229ClientConfig cfg = {
.phys_send_id = 0x18DA66AA,
.func_send_id = 0x18da55aa,
.recv_id = 0x18DAAA66,
.p2_ms = CLIENT_DEFAULT_P2_MS,
.p2_star_ms = CLIENT_DEFAULT_P2_STAR_MS,
.link = &g.clientLink,
.link_receive_buffer = g.clientLinkRxBuf,
.link_recv_buf_size = sizeof(g.clientLinkRxBuf),
.link_send_buffer = g.clientLinkTxBuf,
.link_send_buf_size = sizeof(g.clientLinkTxBuf),
.userCANTransmit = mockClientSendCAN,
.userGetms = mockUserGetms,
.userCANRxPoll = mockClientCANRxPoll,
.userDebug = mockClientLinkDbg,
};
Here is my configuration.
from iso14229.
That configuration looks fine.
The callback function mockClientCANRxPoll
will only be called when you call iso14229SequenceRunBlocking
or the lower-level API Iso14229ClientPoll
from your program.
You can try implementing a sequence like the one here:
Lines 111 to 124 in 27cc02e
from iso14229.
I do not know how it is possible but,
In my
__weak void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan)
{
CAN_RxHeaderTypeDef RxHeader;
uint8_t RxData[8];
/* Prevent unused argument(s) compilation warning */
HAL_CAN_GetRxMessage(hcan, CAN_RX_FIFO0, &RxHeader, RxData);
if(RxData[1] == 80)
{
int i = 1;
}
/* NOTE : This function Should not be modified, when the callback is needed,
the HAL_CAN_RxFifo0MsgPendingCallback could be implemented in the
user file
*/
}
Function, I can see the response message correctly, But,
static enum Iso14229CANRxStatus mockClientCANRxPoll(uint32_t *arb_id, uint8_t *data, uint8_t *dlc) {
if (HAL_OK == HAL_CAN_GetRxMessage(&hcan1, CAN_RX_FIFO0, &rxHeader, TxData)) {
*arb_id = rxHeader.ExtId;
*dlc = rxHeader.DLC;
memmove(data,TxData,*dlc);
return kCANRxSome;
}
else {
return kCANRxNone;
}
}
In this function HAL_CAN_GetRxMessage function can not get anything from bus. Because of this, I can not run sequences.
from iso14229.
You can try either:
- disable the interrupt that calls HAL_CAN_RxFifo0MsgPendingCallback (perhaps the opposite of this issue: https://community.st.com/s/question/0D50X0000AvfKJTSQ2/solved-can-callback-never-call). This should allow you to use
HAL_CAN_GetRxMessage
. - use a queue. Write messages to it in
HAL_CAN_RxFifo0MsgPendingCallback
and read from it elsewhere in your program.
from iso14229.
When I disable Interrupts, TX and RX functions triggered. Thanks.
from iso14229.
Related Issues (15)
- How to use with PCAN HOT 3
- Implementations of function static int LinuxSockBind() and static int LinuxSockTpOpen() do not allow uint32_t rxid and txid HOT 4
- Is it possible to receive ALL responses to a functional request? HOT 6
- working with flexcan in s32ds HOT 5
- UDS client responding with a functional flow control frame to a physically addressed request HOT 6
- compiler warnings after upgrading to release v0.6.0 HOT 3
- clean the memory of struct ifreq ifr and check the return value of ioctl for errors HOT 1
- working with cannelloni as interface HOT 6
- How to implement UDS $2A service(read periodic data by identifier) in this repo? HOT 2
- isotp-c integration (updates) HOT 4
- question on error behavior HOT 4
- Solved : Sequence is not working properly
- Unpacking Security Access Level 1 Data HOT 3
- TransferData Question HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iso14229.