Forum Discussion
Altera_Forum
Honored Contributor
15 years agohostpc like send data to nios II via jtag (nios2-terminal.exe, jtag_atlantis.dll)
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!!! greets26 Replies
- Altera_Forum
Honored Contributor
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 :) - Altera_Forum
Honored Contributor
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.
Thanks.C1 = com.altera.systemconsole.matlabapi.SystemConsoleLink.class C1 = com.altera.systemconsole.core.SystemConsoleProvider.class - Altera_Forum
Honored Contributor
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 ... :( - Altera_Forum
Honored Contributor
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 ... ;) ) - Altera_Forum
Honored Contributor
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)
2) Add the following lines to <matlab>\toolbox\local\classpath.txt:PATH=%PATH%;d:\altera\11.0\quartus\bin\
3) Added the following lines to <matlab>\toolbox\local\librarypath.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
4) Ran matlab, then the following commands:### 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
Good luck.L1 = com.altera.systemconsole.matlabapi.SystemConsoleLink L1.executeTcl('get_service_paths master') M1 = L1.masterOpen('/connections/...paths.../master') M1.masterRead32(0, 16) - Altera_Forum
Honored Contributor
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. - Altera_Forum
Honored Contributor
Hi out there!
in this moment - i found the following datasheet: http://www.altera.com/literature/ds/ds01023.pdf for me its not very funny but there on page 4 is a very very very small "example" of using the Matlabapi - i think. i know the command MasterRead32( ... ) from my studies of the informations, wombat gave me. i was searching many hours - and now that piece of zero information! on page 4 they tell me to visit altera.com :) very funny hohoho... i think, someone from altera is listening to my messages and laughing with his developer friends :( Nowhere on altera.com is any information about how do get the matlabapi work. i know its brand new - quartus2 10.1 or later - but how can i get the informations i need??? why doesn´t altera publish the information on that data sheet or give a link or something? greets - Altera_Forum
Honored Contributor
at the moment i use the following:
com.altera.version.jar com.altera.utilities.jar com.altera.ui.jar com.altera.tcl.interpreter.jar com.altera.service.jre.jar com.altera.systemconsole.app.jar com.altera.systemconsole.dashboard.jar com.altera.systemconsole.designs.jar com.altera.systemconsole.gdbserver.jar com.altera.systemconsole.gui.jar com.altera.systemconsole.issp.jar com.altera.systemconsole.jar com.altera.systemconsole.matlabapi.jar com.altera.systemconsole.monitor.jar com.altera.systemconsole.nios2.dpx.jar com.altera.systemconsole.plugin.elf.jar com.altera.systemconsole.plugin.jtag.jar com.altera.systemconsole.plugin.memory.jar com.altera.systemconsole.plugin.pli.jar com.altera.systemconsole.scripting.jar com.altera.systemconsole.tcpchannel.jar com.altera.systemconsole.transceivers.jar com.altera.systemconsole.usb.jar com.altera.tcl.ui.jar com.altera.tools.exampledesigns.jar com.altera.tools.sopcformats.jar com.altera.ui.ientity.jar i also tryed to use all *.jar from quartus/sopc_builder/model/lib - no success. i thought about a problem with different versions of java. but i use the newest one (Java VM Version: Java 1.6.0_12-b04 with Sun Microsystems Inc. Java HotSpot(TM) Client VM mixed mode) i know the the com.altera.* was generated with 1.6.0_02-b06 (Sun Microsystems Inc.) and i tryed to find it, but i think problems could only occur with older java versions. greets - Altera_Forum
Honored Contributor
You're right - you don't need to pass any arguments to SystemConsoleLink. It may be that you've missed something out of your class path to cause this problem, let me take a look...
- Altera_Forum
Honored Contributor
hi!
your information takes me one step further. but now - i get the following error: ------------------------------- ??? Error using ==> javaObject 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 29 L1 = javaObject('com.altera.systemconsole.matlabapi.SystemConsoleLink') ------------------------------- L1 should be my object. in this message i can read, that the function/class want to use something that isnt there and so i get an initialisation problem. the board is connected and i can see the connection working by starting system-console.exe. - so i dont think that it is a connection-problem... is com.altera.systemconsole.matlabapi.SystemConsoleLink the constructor? i think, that i dont have to give arguments to the SystemConsoleLink(), right? i also dont know, perhaps i have to use the MatlabMethod ? but how? or is it an matlabapi internal class for using the matlabapi? in my opinion i have to do the following in matlab: L1 = javaObject('com.altera.systemconsole.matlabapi.SystemConsoleLink'); L1.onemethod(argument) L1.onemethod(argument) L1.onemethod(argument) L1.closeconnection .... delete L1 after complete transmission. anyway - thank you for your time and the very helpful informations !!! greets