EmbDev.net

Forum: FPGA, VHDL & Verilog Interfacing EFB (UFM) with Mico8 Wishbone


von Reto B. (schnuber)


Rate this post
useful
not useful
Hi
I have a MachXO2 Device LCMXO2-7000HE. In my design I have the Lattice 
Mico8 softcore with Wishbone interface (downloaded Reference design). 
Then I have an EFB block where I want to use the UFM.
There are other peripherials to the controller such as UART and they all 
work fine.
But I don't manage to get the communication going with the UFM. Maybe I 
am doing something wrong with the protocol or timing. Can anyone provide 
me a reference code where I can see how the communication with the UFM 
via Wishbone is done.

Any help appreciated.

Sincerely

von Lattice User (Guest)


Rate this post
useful
not useful
How to access the UFM you will find in this docoument page 73 ff

http://www.latticesemi.com/view_document?document_id=46300

von Reto B. (schnuber)


Rate this post
useful
not useful
Thanks
I actually studied that document already, but I am still not able to 
establish communication. That is why I ask if someone can provide me a 
working reference code either in C or assembler.
But maybe you are right, I have to analyze the wishbone signals with an 
logic analyzer to see whether I meet the timings exactly as described in 
this document.

Sincerely

von Lattice User (Guest)


Rate this post
useful
not useful
Sorry i can't provide a sample for the Mico8, only general help.
(i have used a simple FSM to read one page in my projects)

Don't worry about the WB timing, the Mico8 core should do it correctly.
1
enable the configuration interface
2
3
0x80   -> 0x70  Open frame
4
0x74   -> 0x71  Cmd
5
0x08   -> 0x71
6
0x00   -> 0x71
7
0x00   -> 0x71
8
0x00   -> 0x70  Close frame
9
10
WAIT 5 usec.
11
12
Set page address
13
14
0x80   -> 0x70
15
0xB4   -> 0x71
16
0x00   -> 0x71
17
0x00   -> 0x71
18
0x00   -> 0x71
19
20
0x40   -> 0x71
21
0x00   -> 0x71
22
PageH  -> 0x71
23
PageL  -> 0x71
24
0x00   -> 0x70
25
26
read page
27
28
0x80   -> 0x70
29
0xCA   -> 0x71
30
// here i have a small delay, not sure why
31
0x10   -> 0x71
32
0x00   -> 0x71
33
0x01   -> 0x71
34
35
          0x73 -> Byte 0
36
          0x73 -> Byte 1
37
          ...
38
          0x73 -> Byte 15
39
40
0x00   -> 0x70
41
42
disable config interface
43
44
0x80   -> 0x70
45
0x26   -> 0x71
46
0x00   -> 0x71
47
0x00   -> 0x71
48
0x80   -> 0x70
49
50
bypass
51
52
0x80   -> 0x70
53
0xFF   -> 0x71
54
0xFF   -> 0x71
55
0xFF   -> 0x71
56
0xFF   -> 0x71
57
0x80   -> 0x70

von Reto B. (schnuber)


Rate this post
useful
not useful
Thanks Lattice User
My Assembler Code in Mico8 looks like this.
Here I try to read the device ID as you suggested in the first post.

When I read back the Device ID into register r17-20 I just got all zeros 
in it. I guess I have to analyse with a Logic Analyzer to see what is 
wrong.

What is your opinion on this code
1
  movi r15, FLASH       ;Address of peripherial
2
  movi r11, CFGCR       ;Port address Control Register 0x70
3
  movi r13, CFGTXDR   ;Port address Transmit Register 0x71
4
  movi r9, CFGRXDR   ;Port address Receive Register 0x73
5
6
  movi r16, READ_DEVICE_ID ;Define Command 0xE0
7
8
  movi r12, ZERO_OP   ;Null Operand 0x00
9
  movi r10, START_CMD ;Start Byte 0x80
10
  movi r8, END_CMD ;Start Byte 0x00
11
12
;Starte Kommando
13
  exporti r10,r11   ;Assert CFGCR[WBCE]
14
;Send Command
15
  exporti r16,r13 ;Send Command READ_DEVICE_ID
16
  exporti r12,r13   ;Send 0x00 operand 3x
17
  exporti r12,r13
18
  exporti r12,r13
19
;Read Device ID
20
  importi r17,r9
21
  importi r18,r9
22
  importi r19,r9
23
  importi r20,r9
24
;End Kommando
25
  exporti r8,r11   ;De-assert CFGCR[WBCE]

von Lattice User (Guest)


Rate this post
useful
not useful
Hmmmm

What memory modell are you using?

For medium modell my version of the LM8 reference modell documents R13 
as page pointer. From your code it looks like you are using R15.

von Reto B. (schnuber)


Rate this post
useful
not useful
Yes I have r15 and r14 as address register.
I actually dont know what memory model I use, but it is the Reference 
Design RD1026 configured to 32 General Purpose registers.

: Edited by User
von Lattice User (Guest)


Rate this post
useful
not useful
Which version of the Mico8 are you using?

The latest 3.15 supports three meory modes:

small:  no page pointer
medium: R13 is page pointer
large: R13,R14,R15 is page pointer

von Reto B. (schnuber)


Rate this post
useful
not useful
I analyzed the Wishbone signals and surprise: the UFM block actually 
respond to the Read Device ID request. However, due to some timing 
issues the Mico8 importi implementation somehow is not able to capture 
the response from the UFM.

My version of Mico8 is 3.1. I think I might have to update it to 3.15 as 
I infer by your comments. This might help.

Ok see you later, maybe I can do it by Friday.

Sincerely

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.