Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
21611 Discussions

hostpc like send data to nios II via jtag (nios2-terminal.exe, jtag_atlantis.dll)

Altera_Forum
Honored Contributor II
6,690 Views

hi! 

my system: 

cyclone 3 starter kit 

quartus 2 - 9.1 ( licence + nios licence) 

nios 2 system working 

 

goal: 

i want to setup a matlab gui to switch some pio outputs of the nios. with it i want set the options of a dsp-builder-block. i also want to check some pio-inputs in my matlab gui and do something if bit 0 switches from 1 to 0 or something like that. 

i think i can do this by sending chars by alt_getchar() (small c lib) with the nios2-terminal.  

the problem is that when i start a *.m file and the nios2-terminal is waiting of my input, i have no ability to put in the char automatically via a programmed *.m file. 

 

i am also open for other hardware suggestions. 

Problem: 

only a usb-blaster-connection to the board - want no other connection. 

 

i am connected via the integrated usb blaster to the starter board.  

i need a possibility to send just a few bit to the nios via the usb (jtag uart). 

in my opinion - the nios 2 ide is also transfering data to the sopc -system by using nios2-terminal.exe. 

i read the example" high speed image download demo " but could not understand how its done. i am just a beginner with nios and also not so well in programming/compiling to understand how to use the cygwin - environment. - ok i looked in the inet - is a linuxlike environment for windows.  

i also thought about using the fdti-usb driver (set up a virtual serial connection - vcp or d2xx).  

i have no idea if it is possible so easy (without programming a new driver or something like this) 

 

what exactly can i do with nios2-terminal and how? 

(the ' --help' makes no reason for me) 

 

does anyone of you understand what i am talking about? 

need real help!!! 

 

 

greets
0 Kudos
26 Replies
Altera_Forum
Honored Contributor II
1,019 Views

Nice datasheet, I hadn't seen that one. That project is also built on top of the same matlabapi we're talking about. This is pre-release code so it is not documented properly yet. 

 

I have spent the last three days trying to get a Matlab license working on my machine so I can debug this further. This has not left me in a laughing mood I'm afraid. More details soon.
0 Kudos
Altera_Forum
Honored Contributor II
1,019 Views

Ok, so I finally got my Matlab license sorted out and have been able to replicate your results. I got it working with Quartus 11.0 and Matlab 2009a by doing this: 

 

1) Modify your path as follows (I wrote a batch file which does this then runs matlab.exe) PATH=%PATH%;d:\altera\11.0\quartus\bin\2) Add the following lines to <matlab>\toolbox\local\classpath.txt: ### Added for SystemConsole matlabapi d:/altera/11.0/quartus/sopc_builder/model/lib/com.altera.systemconsole.matlabapi.jar d:/altera/11.0/quartus/sopc_builder/model/lib/com.altera.service.jre.jar d:/altera/11.0/quartus/sopc_builder/model/lib/com.altera.utilities.jar d:/altera/11.0/quartus/sopc_builder/model/lib/com.altera.systemconsole.plugin.jtag.jar d:/altera/11.0/quartus/sopc_builder/model/lib/com.altera.systemconsole.usb.jar# ## End classpaths added for SystemConsole matlabapi 3) Added the following lines to <matlab>\toolbox\local\librarypath.txt:### Added for SystemConsole matlabapi d:/altera/11.0/quartus/sopc_builder/model/lib d:/altera/11.0/quartus/bin# ## End of paths added for SystemConsole matlabapi 4) Ran matlab, then the following commands: L1 = com.altera.systemconsole.matlabapi.SystemConsoleLink L1.executeTcl('get_service_paths master') M1 = L1.masterOpen('/connections/...paths.../master') M1.masterRead32(0, 16) Good luck.
0 Kudos
Altera_Forum
Honored Contributor II
1,019 Views

Hi wombat! 

my last message wasn´t direkted to you. - it was only frustrating to find a hint to the solution and the needed information is not public. it also should be just a funny comment :). 

 

thank you for your excellent manual of getting the connection work. 

my only projekt is, that i cannot add the paths to the librarypath.txt. 

i was told that i do not have the rights on my computer to change librarypath.txt. 

when i rename the original librarypath.txt to librarypath_old.txt and put in a 

elsewhere written librarypath.txt. i get the known problem: 

"java.lang.NullPointerException". 

 

so i tryed  

loadlibrary('includepath','c:/altera/11.0/quartus/sopc_builder/model/lib/'); 

loadlibrary('includepath','c:/altera/11.0/quartus/bin/'); 

 

but now i get: 

---------------------- 

??? Error using ==> loadlibrary at 368 

Failed to preprocess the input file. 

Output from preprocessor is:lcc preprocessor fatal: Can't open input file c:/altera/11.0/quartus/sopc_builder/model/lib/ 

----------------------- 

i think matlab wants a *.h, *.dll, ... file. 

 

in my opinion the needed file should be in one *.jar file 

 

i had no success of just loading a directory. 

perhaps you know a solution  

(hope this is the last problem of loading the matlabapi ... ;) )
0 Kudos
Altera_Forum
Honored Contributor II
1,019 Views

ok - now i got the four (two needed) lines to the  

librarypath.txt. Same error :( 

------------------------ 

??? Java exception occurred: 

java.lang.NullPointerException 

 

at com.altera.systemconsole.matlabapi.SystemConsoleLink.<init>(SystemConsoleLink.java:46) 

 

at com.altera.systemconsole.matlabapi.SystemConsoleLink.<init>(SystemConsoleLink.java:31) 

 

 

Error in ==> test_jar at 33 

L1 = com.altera.systemconsole.matlabapi.SystemConsoleLink 

--------------------------------- 

 

in the help i read about differences with 64bit. 

but i use matlab2010a 32 bit and also the *.jar should be 32bit... 

i have no idea ... :(
0 Kudos
Altera_Forum
Honored Contributor II
1,019 Views

Hi, 

 

I'll reply to both the last postings together. 

 

The settings in librarypath.txt are needed because SystemConsole uses its own DLLs to communicate with the hardware, for example the JTAG interface uses JtagJNI.dll and jtag_client.dll to talk to the hardware. The librarypath.txt changes tell Matlab to tell Java to look in the locations specified for the jars which have been loaded. It looks like you've fixed that though (you will get "unable to find dependent library" errors if you haven't). 

 

The error you're seeing again suggests that com.altera.systemconsole.jar didn't load up right. 

 

Let's try the unlikely reasons first. I'm using Matlab 2009a and you are using 2010a. Is there an easy way for you to test it in the other version? 

 

You should certainly be using 32 bit Matlab. Jars don't care but the SystemConsole native libraries don't support 64 bit. I don't think this is your error because I would expect a different error message if it was. 

 

Finally, can you post the output from the `javaclasspath` command and then try and load a couple of classes by hand. This code is accessing the class objects to check whether the classes loaded but without running any code within the classes. 

C1 = com.altera.systemconsole.matlabapi.SystemConsoleLink.class C1 = com.altera.systemconsole.core.SystemConsoleProvider.classThanks.
0 Kudos
Altera_Forum
Honored Contributor II
1,019 Views

ahhh - forgot... 

i also tryed it with matlab 2009b. 

the only other version i got. 

you can also see it in error_load_class.pdf  

:)
0 Kudos
Reply