Hi Peter, I was thinking about that, the thing is that we are using Nuttx as a submodule in our system and we haven't updated it in a while so right now we are using a quite older version and I'm not able to test the fix in master. I can send a PR but I don't think it will be approved without the proper testing. WDYT?
Thanks Javier Casas Marín Geotab Senior Embedded Systems Developer Direct Toll-free Visit +34 900 535 371 www.geotab.com/es Twitter <https://twitter.com/geotab> | Facebook <https://www.facebook.com/Geotab> | YouTube <https://www.youtube.com/user/MyGeotab> | LinkedIn <https://www.linkedin.com/company/geotab/> On Thu, Mar 6, 2025 at 3:24 PM Peter van der Perk <peter.vanderp...@nxp.com> wrote: > Hi Javier, > > Good to hear. > If it working fine for you with the fix, feel free to send a PR into > upstream NuttX. > > Yours sincerely, > > Peter van der Perk > > -----Original Message----- > From: Javier Casas Marin <javierca...@geotab.com.INVALID> > Sent: Thursday, March 6, 2025 2:59 PM > To: dev@nuttx.apache.org > Subject: Re: socket CAN timestamp missing > > Caution: This is an external email. Please take care when clicking links > or opening attachments. When in doubt, report the message using the 'Report > this email' button > > > Hi Peter, > > Thanks for answering. You are right, moving the timestamp generation back > up fixes the issue and it makes more sense to have the code there, before > branching the code flow, than having it duplicated in both paths. > > Thanks! > > Javier Casas Marín > Geotab > > Senior Embedded Systems Developer > > Direct > Toll-free > > Visit > > > +34 900 535 371 > http://www.geotab.com/es > > Twitter <https://twitter.com/geotab> | Facebook < > https://www.facebook.com/Geotab> | YouTube < > https://www.youtube.com/user/MyGeotab> | LinkedIn < > https://www.linkedin.com/company/geotab/> > > > On Wed, Mar 5, 2025 at 7:11 PM Peter van der Perk < > peter.vanderp...@nxp.com> > wrote: > > > Hi Javier, > > > > I think it's a regression from the IOB rewrite. > > > > The original implementation added the timestamp before calling either > > devif_conn_event or can_data_event. > > > > https://gith/ > > ub.com%2Fapache%2Fnuttx%2Fblob%2F55d9e5f7af05e75ca62f57863b880d723aa83 > > c56%2Fnet%2Fcan%2Fcan_callback.c%23L123-136&data=05%7C02%7Cpeter.vande > > rperk%40nxp.com%7Cf104859d6a1a445d62a808dd5cb71af1%7C686ea1d3bc2b4c6fa > > 92cd99c5c301635%7C0%7C0%7C638768663693812678%7CUnknown%7CTWFpbGZsb3d8e > > yJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWF > > pbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=rmMl%2BcVzdMZPrTpl1GcKUUfszm9 > > tDf1Oi1K%2FN%2F6kqF4%3D&reserved=0 > > > > I think moving the code up would fix it. > > > > Yours sincerely, > > > > Peter van der Perk > > > > -----Original Message----- > > From: Javier Casas Marin <javierca...@geotab.com.INVALID> > > Sent: Wednesday, March 5, 2025 2:27 PM > > To: dev@nuttx.apache.org > > Subject: socket CAN timestamp missing > > > > Hi Nuttxaddicts, > > > > After configuring the CAN socket with SO_TIMESTAMP, the application > > reading the socket is sometimes getting an empty timestamp in some > > situations. I've been debugging this issue and I this is what I found: > > > > There are two paths when receiving a CAN frame from the interrupt, if > > there is someone waiting for a frame, the can_recvfrom_eventhandler > > callback is called to deliver the frame to the application, otherwise > > the frame is stored in the read-ahead list. > > > > When there is no listener available the timestamp is generated in the > > can_callback function just before calling can_data_event to store the > > CAN frame in the read-ahead list. But, if there is a listener waiting, > > the can_recvfrom_eventhandler is called and the timestamp is not > > generated at all, so the recvmsg call in the application side returns an > empty timestamp. > > > > I think this is a bug. Why is the timestant not added in the explained > > case? Adding it in the can_recvfrom_newdata function solves the issue. > > > > Javier Casas Marín > > Geotab > > > > Senior Embedded Systems Developer > > > > Direct > > Toll-free > > > > Visit > > > > > > +34 900 535 371 > > http://www.g/ > > eotab.com%2Fes&data=05%7C02%7Cpeter.vanderperk%40nxp.com%7Cf104859d6a1 > > a445d62a808dd5cb71af1%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C638 > > 768663693830272%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOi > > IwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C% > > 7C%7C&sdata=h2hUAcDskib8Ls0VEGXMTpYKCG%2B%2FAO24TAV5KhcHT5w%3D&reserve > > d=0 > > > > Twitter > > <https://twi/ > > tter.com%2Fgeotab&data=05%7C02%7Cpeter.vanderperk%40nxp.com%7Cf104859d > > > 6a1a445d62a808dd5cb71af1%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C638768663693847889%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=YKDNsDL62ZkxjJ%2FhSttjkxFxdghfZmqY4MNVXgFBzq4%3D&reserved=0> > | Facebook < https://www.facebook.com/Geotab> | YouTube < > https://www.youtube.com/user/MyGeotab> | LinkedIn < > https://www.linkedin.com/company/geotab/> > > >