ColorCNC Colorlight 5A-75E/5A-75B as FPGA controller board

More
4 years 2 months ago #249642 by vit74vit
Problem: sizeof(litexcnc_stepgen_general_write_data_t) return 24typedef struct {    uint32_t steplen;    uint32_t dir_hold_time;    uint32_t dir_setup_time;    uint64_t apply_time;} litexcnc_stepgen_general_write_data_t;PS: Aligning structures results in an error. The incorrect read/write buffer length was caused by this. Updated stepgen.h file. I continue to test.

Please Log in to join the conversation.

More
4 years 2 months ago #249674 by TOLP2
How can it be that the sizeof return 24, I do really count only 20 bytes ... But this explains why it does work on my system (32-bit), because this architecture is quiet becoming obsolete, I think you use 64-bit architectures.

So either I have to replace all sizeof with macros or find a way to make it portable between the architetures. My gratitude for solving this problem is huge...

Edit: I've just committed a modified version of the driver. I've replaced all occurrences of 'sizeof' with hardcoded sizes of the read and write data-structs.

Please Log in to join the conversation.

More
4 years 2 months ago #249698 by vit74vit
Peter!
137 line in stepgen.h should be modifed :
stepgen.num_instances?sizeof(litexcnc_stepgen_general_write_data_t):0)
stepgen.num_instances?20:0)

PS:I don't like to use "magic number".
I propose to use forced alignment during packaging
#pragma pack(push,4)
...... structure.....
#pragma pack(pop)

Please Log in to join the conversation.

More
4 years 2 months ago #249716 by vit74vit
Peter, see this example:
struct Foo
{
char ch;
int value;
};

struct Foo1
{
char ch1;
char ch2;
int value1;
};
#pragma pack(push,1)
struct Foo3
{
char ch3;
int value3;
};
#pragma pack(pop)
result out:
sizeof(Foo )=8   (bytes of memmory: 1-ch 2-empty 3-empty 4-empty 5-value[0] 6-value[1] 7-value[2] 8-value[3])
sizeof(Foo1)=8
sizeof(Foo3)=5  (bytes of memmory: 1-ch 2-value[0] 3-value[1] 4-value[2] 5-value[3])

Please Log in to join the conversation.

More
4 years 2 months ago #249729 by romanetz
Pay attention that etherbone protocol requires 4-byte alignment

Please Log in to join the conversation.

More
4 years 2 months ago #249734 by TOLP2
@romanetz: The problem is the difference in packing required for etherbone (4-byte) and the packing used by x64-systems. As I had only 32-bit system, the alignement was correct by chance. On 64-bit systems the width is 8 byte and then things go wrong.

@vit74vit: Thanks for spotting the last missed sizeof in the stepgen header and for the examples on packing. I think there are two ways forward from here:
- replace the magic variables with macro's and store these close to the structs.
- change the packing. However this might impact the speed of the driver. Do you know what the impact is and whether it is acceptable?

Please Log in to join the conversation.

More
4 years 2 months ago #249745 by svb
Last test: GIT 22ccd7e4cd96a423b927e0bd33cd00f54fc9fcac
Recompile firmware and driver
Motion fading in video is not a rendering issue, it's a real motion interruption

Video


Screenshot terminal window

Attachment not found


 

Please Log in to join the conversation.

More
4 years 2 months ago #249747 by svb
With Fabio's driver and firmware everything works fine if there is no ethernet packet loss. More than 4 hours of continuous operation without a single failure. I'm run flood ping to board from 3 terminals and all work fine.
I'm connect motors on Y, and test on real hardware.

From time to time packet's lost (i'm don't know why) and all stopped. But NO MOVING after error!
 

Please Log in to join the conversation.

More
4 years 2 months ago #249755 by romanetz
Can you point to these versions?
Standard behaviour of of-the-shelf products is to ignore packet loss until timeout has been occured. Loss of packet must only be counted for link quality metering.

Please Log in to join the conversation.

More
4 years 2 months ago #249780 by svb

Please Log in to join the conversation.

Time to create page: 0.202 seconds
Powered by Kunena Forum