{"action":"closed","issue":{"url":"https://api.github.com/repos/rbei-etas/busmaster/issues/756","repository_url":"https://api.github.com/repos/rbei-etas/busmaster","labels_url":"https://api.github.com/repos/rbei-etas/busmaster/issues/756/labels{/name}","comments_url":"https://api.github.com/repos/rbei-etas/busmaster/issues/756/comments","events_url":"https://api.github.com/repos/rbei-etas/busmaster/issues/756/events","html_url":"https://github.com/rbei-etas/busmaster/issues/756","id":46312946,"number":756,"title":"Signal packing problem in simulation","user":{"login":"nostar","id":3847102,"avatar_url":"https://avatars.githubusercontent.com/u/3847102?v=3","gravatar_id":"","url":"https://api.github.com/users/nostar","html_url":"https://github.com/nostar","followers_url":"https://api.github.com/users/nostar/followers","following_url":"https://api.github.com/users/nostar/following{/other_user}","gists_url":"https://api.github.com/users/nostar/gists{/gist_id}","starred_url":"https://api.github.com/users/nostar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nostar/subscriptions","organizations_url":"https://api.github.com/users/nostar/orgs","repos_url":"https://api.github.com/users/nostar/repos","events_url":"https://api.github.com/users/nostar/events{/privacy}","received_events_url":"https://api.github.com/users/nostar/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rbei-etas/busmaster/labels/1.3%20patch%20(defect)","name":"1.3 patch (defect)","color":"e10c02"},{"url":"https://api.github.com/repos/rbei-etas/busmaster/labels/3.2%20medium%20priority%20(EC2)","name":"3.2 medium priority (EC2)","color":"d7e102"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/rbei-etas/busmaster/milestones/43","html_url":"https://github.com/rbei-etas/busmaster/milestones/v3.0.0","labels_url":"https://api.github.com/repos/rbei-etas/busmaster/milestones/43/labels","id":1859528,"number":43,"title":"v3.0.0","description":"1. CAN Transmit Windows\r\n   - UI Redesign \r\n   - Message wise raster support \r\n2. Node Simulation \r\n   - Big Endian support \r\n   - Message and Signal access is simplified \r\n3. Signal watch configuration window is updated with channel wise signal details \r\n4. Bug Fixes \r\n5. Architecture enhancement","creator":{"login":"RBEI-busmaster","id":18186340,"avatar_url":"https://avatars.githubusercontent.com/u/18186340?v=3","gravatar_id":"","url":"https://api.github.com/users/RBEI-busmaster","html_url":"https://github.com/RBEI-busmaster","followers_url":"https://api.github.com/users/RBEI-busmaster/followers","following_url":"https://api.github.com/users/RBEI-busmaster/following{/other_user}","gists_url":"https://api.github.com/users/RBEI-busmaster/gists{/gist_id}","starred_url":"https://api.github.com/users/RBEI-busmaster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RBEI-busmaster/subscriptions","organizations_url":"https://api.github.com/users/RBEI-busmaster/orgs","repos_url":"https://api.github.com/users/RBEI-busmaster/repos","events_url":"https://api.github.com/users/RBEI-busmaster/events{/privacy}","received_events_url":"https://api.github.com/users/RBEI-busmaster/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":11,"state":"open","created_at":"2016-07-01T10:12:25Z","updated_at":"2016-07-01T12:24:51Z","due_on":"2016-07-03T18:30:00Z","closed_at":null},"comments":1,"created_at":"2014-10-20T19:05:08Z","updated_at":"2016-07-01T12:24:51Z","closed_at":"2016-07-01T12:24:51Z","body":"I created a small test simulation & database to describe this problem. I created a dbf with 6 Motorola unsigned ints in msg01.  The first 3 in order are 8 bit, then 2 16 bit, then one more 8 bit.  The problem is that busmaster simulated node refuses to send a 16bit signal at byte index 4 (which would be 3 and 4), instead it transmit the signal data on byte 4 and byte 5, so it overwrites half of the following signal.  The next 16 bit signal is also shifted over by 1 byte, and finally, the last signal in the message doesnt show up in the message at all.  In the simulation, Sig04 in msg01 has a padding byte added to the struct which shouldn't be there.  Even if I comment it out though, the signal is still packed into the message incorrectly.  It will pack correctly if move Sig04 up to the first, second, or third location, but it always jumps over byte location 4.  In the simulation I send:\r\n\r\nMsg01_tx.m_sWhichBit.Sig04 = 0x1234;\r\n\r\nand the result is: \r\n00 00 00 00 34 12 00 00\r\n\r\nIt should be:\r\n00 00 00 34 12 00 00 00\r\n\r\nI am aware of the byte order issue #750 but this is something else.\r\n\r\nI created msg02 full of 8 bytes, no problems there.  I can send a zip file of the small (25KB) simulation if anyone wants it.\r\n\r\nbyteorder.dbf:\r\n//******************************BUSMASTER Messages and signals Database ******************************//\r\n\r\n[DATABASE_VERSION] 1.3\r\n\r\n[PROTOCOL] CAN\r\n\r\n[BUSMASTER_VERSION] [2.5.0]\r\n\r\n[NUMBER_OF_MESSAGES] 2\r\n\r\n[START_MSG] msg01,258,8,6,1,S\r\n[START_SIGNALS] Sig01,8,1,0,U,255,0,0,0.000000,1.000000,,\r\n[START_SIGNALS] Sig02,8,2,0,U,255,0,0,0.000000,1.000000,,\r\n[START_SIGNALS] Sig03,8,3,0,U,255,0,0,0.000000,1.000000,,\r\n[START_SIGNALS] Sig04,16,5,0,U,65535,0,0,0.000000,1.000000,,\r\n[START_SIGNALS] Sig05,16,7,0,U,65535,0,0,0.000000,1.000000,,\r\n[START_SIGNALS] Sig06,8,8,0,U,255,0,0,0.000000,1.000000,,\r\n[END_MSG]\r\n\r\n[START_MSG] msg02,259,8,8,1,S\r\n[START_SIGNALS] sig0,8,1,0,U,85,0,0,0.000000,1.000000,,\r\n[START_SIGNALS] sig1,8,2,0,U,85,0,0,0.000000,1.000000,,\r\n[START_SIGNALS] sig2,8,3,0,U,85,0,0,0.000000,1.000000,,\r\n[START_SIGNALS] sig3,8,4,0,U,85,0,0,0.000000,1.000000,,\r\n[START_SIGNALS] sig4,8,5,0,U,255,0,0,0.000000,1.000000,,\r\n[START_SIGNALS] sig5,8,6,0,U,255,0,0,0.000000,1.000000,,\r\n[START_SIGNALS] sig6,8,7,0,U,255,0,0,0.000000,1.000000,,\r\n[START_SIGNALS] sig7,8,8,0,U,255,0,0,0.000000,1.000000,,\r\n[END_MSG]\r\n\r\nbyteorder_Unions.h\r\n/* This is an ALWAYS automatically generated file based on the database ... */\r\n/*It is recommended to change the database directly. If you want to prevent overwritten header files, make a copy of it and ensure you include the intended version in your node simulation.*/\r\n\r\n#pragma once\r\n#pragma pack(pop,8)\r\n\r\n#ifndef MESSAGENAME_msg01\r\n#define MESSAGENAME_msg01\r\ntypedef union \r\n{\r\n\tunsigned char      m_aucData[64];\r\n\tunsigned short int m_auwData[4];\r\n\tunsigned long  int m_aulData[2];\r\n\r\n\tstruct\r\n\t{\r\n\t    unsigned int Sig01            :  8 ;\r\n\t    unsigned int Sig02            :  8 ;\r\n\t    unsigned int Sig03            :  8 ;\r\n\t    unsigned int                  :  8 ;//This shouldn't be here\r\n\t    unsigned int Sig04            : 16 ;\r\n\t    unsigned int Sig05            : 16 ;\r\n\t    unsigned int Sig06            :  8 ;\r\n\r\n\t} __attribute__((__packed__));\r\n}msg01_;\r\ntypedef struct \r\n{\r\n\tunsigned int  m_unMsgID       ;\r\n\tunsigned char m_ucEXTENDED    ;\r\n\tunsigned char m_ucRTR         ;\r\n\tunsigned char m_ucDLC         ;\r\n\tunsigned char m_ucChannel\t;\r\n\tmsg01_        m_sWhichBit     ;\r\n\r\n\tUINT m_ulTimeStamp;\r\n\tbool\t\t     m_bCANFD        ;\r\n\r\n} msg01;\r\n#endif /* MESSAGENAME_msg01 */\r\n\r\n\r\n#ifndef MESSAGENAME_msg02\r\n#define MESSAGENAME_msg02\r\ntypedef union \r\n{\r\n\tunsigned char      m_aucData[64];\r\n\tunsigned short int m_auwData[4];\r\n\tunsigned long  int m_aulData[2];\r\n\r\n\tstruct\r\n\t{\r\n\t    unsigned int sig0             :  8 ;\r\n\t    unsigned int sig1             :  8 ;\r\n\t    unsigned int sig2             :  8 ;\r\n\t    unsigned int sig3             :  8 ;\r\n\t    unsigned int sig4             :  8 ;\r\n\t    unsigned int sig5             :  8 ;\r\n\t    unsigned int sig6             :  8 ;\r\n\t    unsigned int sig7             :  8 ;\r\n\r\n\t} __attribute__((__packed__));\r\n}msg02_;\r\ntypedef struct \r\n{\r\n\tunsigned int  m_unMsgID       ;\r\n\tunsigned char m_ucEXTENDED    ;\r\n\tunsigned char m_ucRTR         ;\r\n\tunsigned char m_ucDLC         ;\r\n\tunsigned char m_ucChannel\t;\r\n\tmsg02_        m_sWhichBit     ;\r\n\r\n\tUINT m_ulTimeStamp;\r\n\tbool\t\t     m_bCANFD        ;\r\n\r\n} msg02;\r\n#endif /* MESSAGENAME_msg02 */\r\n\r\n1.cpp (my node)\r\n/* This file is generated by BUSMASTER */\r\n/* VERSION [1.1] */\r\n/* BUSMASTER VERSION [2.5.0] */\r\n/* PROTOCOL [CAN] */\r\n\r\n/* Start BUSMASTER include header */\r\n#include <Windows.h>\r\n#include <CANIncludes.h>\r\n\r\n#include \"C:\\Users\\cz0n9v\\Documents\\busmaster\\configs\\byteorder\\byteorder_Unions_fixed.h\"\r\n/* End BUSMASTER include header */\r\n\r\n\r\n/* Start BUSMASTER global variable */\r\nmsg01 Msg01_tx = {0x102, 0, 0, 8, 1};\r\n/* End BUSMASTER global variable */\r\n\r\n\r\n/* Start BUSMASTER Function Prototype  */\r\nGCC_EXTERN void GCC_EXPORT OnTimer_timer_100ms_100( );\r\nGCC_EXTERN void GCC_EXPORT OnBus_Connect();\r\nGCC_EXTERN void GCC_EXPORT OnBus_Disconnect();\r\n/* End BUSMASTER Function Prototype  */\r\n\r\n/* Start BUSMASTER generated function - OnTimer_timer_100ms_100 */\r\nvoid OnTimer_timer_100ms_100( )\r\n{\r\n\tMsg01_tx.m_sWhichBit.Sig04 = 0x1234;\r\n\tSendMsg(*((STCAN_MSG *)&Msg01_tx));\r\n}/* End BUSMASTER generated function - OnTimer_timer_100ms_100 */\r\n/* Start BUSMASTER generated function - OnBus_Connect */\r\nvoid OnBus_Connect()\r\n{\r\nStartTimer(\"timer_100ms\", 100);\r\n}/* End BUSMASTER generated function - OnBus_Connect */\r\n/* Start BUSMASTER generated function - OnBus_Disconnect */\r\nvoid OnBus_Disconnect()\r\n{\r\nStopTimer(\"timer_100ms\");\r\n}/* End BUSMASTER generated function - OnBus_Disconnect */\r\n"}}
{"actor":{"display_login":"RBEI-busmaster"}}