C-code to control FPGA with Leon

Hallo, i have a leon Processor and a CAN IP-core. i have connect CAN IP-core to Leon with APB Slave and the whole Model in bitstream File exported. The CAN IP-core has defined 32 Register, which also have in leon the address. Now in the C-Code i want to send a message from CAN IP-core. Do i only need to write the message in Transffer Register from CAN IP-core and just let the CommandRegister from CAN IP-core send the message? and if not, how to send a message and how should i write in the C-code?

thanks in advance

krebs

Reply to
krebs
Loading thread data ...

It entirely depends on the specific CAN core you are using. Surely it came with ample documentation to describe how to do this basic thing? If the core lacks this documentation, please tell us which core so that we may all avoid it in the future. If, however, it has such documentation, then perhaps you can share with us the part that you don't understand.

Traditional CAN modules such as the SJA1000 allow you to create a message by writing its contents to registers, as you suggest. You must also remember to configure the identifier and other features of the message. Then you write some kind of "start" command to a control register. The message then probably goes into a FIFO buffer so that it can be sent automatically by the hardware at some future time. There is probably an interrupt output, or a status register, allowing you to determine when the message has been sent. Also, don't forget to check for the many possible error conditions that CAN checks so carefully.

--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL, Verilog, SystemC, Perl, Tcl/Tk, Verification, Project Services

Doulos Ltd. Church Hatch, 22 Market Place, Ringwood, BH24 1AW, UK
Tel: +44 (0)1425 471223          mail:jonathan.bromley@doulos.com
Fax: +44 (0)1425 471573                Web: http://www.doulos.com

The contents of this message may contain personal views which 
are not the views of Doulos Ltd., unless specifically stated.
Reply to
Jonathan Bromley

as said, i have to connect the CAN IP-Core with Leon Processor and implement the whole modul in a FPGA Board.

i have downloaded Leon Core from

formatting link
and CAN IP-Core from
formatting link
So there was not much documentation for the CAN IP-Core. In my Opinion, the CAN IP-Core is quite similar to the SJA1000 Pelican, but not the same. in my CAN Core, from the Register

10 to 19, it refers to tx_data_0 to tx_data_9, and from Register 20 to 29 refers to rx_data_0 to rx_data_9.

As said, i have connected the CAN Core to Leon as an APB-Slave and to send a message from Can Core, i have written a C-Code with following steps:

1) i write the data to tx_data_0 to tx_data_9 register. the tx_data_0 and tx_data_1 Register has the information of the Identifier, RTR and Data length.

2) then i set the command register of 0x01 to send the message.

3) i have disabled the interrupt register and error register and just want to sent a message first.

4) to observe the can bus i have the CANalyzer.

Just till now, i have not received single message.

Reply to
krebs

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.