- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
recently, i am working on can bus communication of fpga. i downlownded an ip core from opencore. i use the ip core through c8051 interface. it is bulit in the system like:https://www.alteraforum.com/forum/attachment.php?attachmentid=7256 , i process the ip core in nios like this: void Write_Reg(alt_u8 addr, alt_u8 reg_data)
{ //write reg ALE_LOW; SJA_CS_HI; RD_HI; WR_HI; ALE_HI; PORT_OUT; usleep(1); IOWR_ALTERA_AVALON_PIO_DATA(CAN_DAT_BASE,addr);//写地址 usleep(1); ALE_LOW; SJA_CS_LOW; WR_LOW; usleep(1); //PORT_IN; IOWR_ALTERA_AVALON_PIO_DATA(CAN_DAT_BASE,reg_data);//写数据 WR_HI; SJA_CS_HI; ALE_HI; } alt_u8 Read_Reg(alt_u8 addr) { alt_u8 reg_data; WR_HI; SJA_CS_HI; ALE_HI; //read reg ALE_LOW; RD_HI; WR_HI; SJA_CS_HI; ALE_HI; usleep(1); PORT_OUT; IOWR_ALTERA_AVALON_PIO_DATA(CAN_DAT_BASE,0);//写地址 usleep(1); ALE_LOW; SJA_CS_LOW; RD_LOW; usleep(1); PORT_IN; reg_data=IORD_ALTERA_AVALON_PIO_DATA(CAN_DAT_BASE);//读数据 usleep(1); RD_HI; SJA_CS_HI; return reg_data; } simulate as its reading and writing timing.https://www.alteraforum.com/forum/attachment.php?attachmentid=7257 https://www.alteraforum.com/forum/attachment.php?attachmentid=7258 but it's always 0xff when i read from the SJA1000 regs no matter what value i write to its regs.Link Copied
7 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
anyone who knows? please help me! help!help!help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
help......
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What nios? Could you post your QSYS/SOPC Builder system?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What is inside!?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
just some generation purpose io ports to control can bus soft ip core, as:
can_cs output can_rst output can_wr output can_rd output can_ale output can_dat[0:7] bidirection & can_irq(input) to caputrue interrput from can ip core- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i just simulate my control logic as c8051 microchip to control can bus controller------sja1000

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page