chdir not working on Spartan 6 SP605 FPGA - fpga

I am working on a project that uses the Spartan 6 FPGA eval kit.
The problem I am having is that when trying to change the directory on the CF card, the software can't build the working stack.
The directory is "a:\\setup" and that is being passed to the sysace_chdir(const char *path) function.
When I try to add some print code to debug the problem, none of the changes are registered.
In the SDK, I have the MicroblazeProc_hw_platform, then my project, then a standalone_bsp_0 project, which has the sysace_chdir() function in it.
When I build all the projects, the simple print statements (I use xil_printf() for output) do not display in the output.
Any help would be great.
PS - I am connected to the FPGA in the SDK using a COM port, and other print statements do get output during the initialization of the other things like the UARTs, so this is not a problem with output to the terminal or anything.

I think I figured out what the problem was.
I inserted my card into a USB card reader and formatted it using a FAT32 file system.
As for the cnages in the BSP, I was not able to figure that out, but the code is now able to change directory.
The wierd thing is that after the code is executed, if I pull out the CF card and insert it into my pc, I don't see the newly created directory. I don't know why.

Related

Running structured text files in Raspberry pi 3

I have my raspberry pi3 and I did a small basic code in a text editor in structured text language. I don't know how to run the code in the terminal. I'm running OPEN PLC in raspberry pi. So there should be some way to run the structured text language code within the terminal.
Any suggestions would be helpful.
I have saved the file in .st extention which seems to be the extension for the structured text file. When I type the filename.st in a terminal, it says command cannot be executed.
The error message when I try to run the code, it says command cannot be executed. I would like to know how to compile and run the file ( in .st Extention) in the terminal.
None of the controllers ever run ST code directly. Before it gets to the plc it is compiled at least to С or even Machine code. So you cannot run your ST file directly. The only ways are.
You can use logi.CAD3. There is instruction on how to install RT on pi. In this case, you can use PI like a PLC and logi.CAD3 like IDE where you can write ST program.
Use CoDeSys. ерун have PI runtime too. But it cost money per license. Install it and Codesys will be IDE for PI.
Use OpenPLC Runtime and IDE. This will allow you to upload ST file on your PLC (Raspberry Pi)

Error Initializing the StructureSensor with OpenNI2 and NiViewer

This query is related to configuring the Occipital Structure Sensor with the OpenNI2 SDK. The SDK has already been in use with the MS Kinect family of depth-sensing devices originating from the XBox 360 technology. The Structure Sensor is basically an overwhelmingly reduced version of MS Kinect/Carmine which is specifically built with the iPad in mind. However, the manufacturers have made it configurable with the OpenNI2 SDK as well.
I am trying to configure this device with the NiViewer provided as part of the OpenNI2 interface. Based on the quick start guide at the following link, the "UsbInterface=2" must be changed to "UsbInterface=0" in the PS1080.ini file and this step should allow the depth and IR streams of this device to work properly.
http://com.occipital.openni.s3.amazonaws.com/Structure%20Sensor%20OpenNI2%20Quick%20Start%20Guide.pdf
However, when the NIViewer is run, despite showing the device as connected, it does not stream any of the streams of this device. After a bit of trying, I found that it was possible to right-click on the NIViewer and manually enable both the (the depth and IR) streams. However, when this is done, the following error appears (for the IR stream attempt):
Failed to create IR Stream: XnOniDevice: Can't initialize stream of type 1: Failed to set USB interface!
Stream: couldn't create using source 1
Context: Couldn't create stream from device: 0237c220, source 1
Based on my own search, similar "failed to set USB interface" problems are reported for Kinect with MACOSX but the solution is not really specific to the Structure Sensor with the Windows 7 64-bit.
If you directly look into the XnOniDevice.cpp, it does show unavailability of streams being caught:
https://github.com/OpenNI/OpenNI2/blob/master/Source/Drivers/PS1080/DriverImpl/XnOniDevice.cpp
I reckon, a recompilation of source should not be necessary as this was not required for Windows-based systems. Any help in this regard would be highly appreciated. I'll report back if I found a solution to this issue.
After looking further into the editing details of the "PS1080.ini" file, I noticed that the solution to this problem was a simple one. The semicolons ';' in the INI file are basically used in commenting and that's where the mistake was. If you forget to remove the ';' before the "UsbInterface=0" command, the comment is basically ignored. Once saved, the Sensor works perfectly and both the Depth and IR feeds can be seen in the NIViewer window.

Terminal program to CSV

I have a little project at work, but I'm stuck in my tracks at the moment. We have quite a few Motorola MC1000 hand held barcode scanners at work, doing nothing at the moment, and I want to get them working again for stock takes and what not.
Now, these were pre-installed with a program called MCA, which is a simple barcode scanner and quantity program, which I'm not sure where it saves this information (maybe in memory), but I am unable to get the data from just connecting the device via USB.
On the program, there is a section called "send data" which then outputs data via COM1 port. I have managed to intercept the old program we used to read the barcodes (there is no way to export from this old program), so I need something new, where I can export barcode, quantity via CSV.
Using serialmon, I have found that I can read the barcode, plus some extra confirmations? then the quantity, plus more confirmations, then the next barcode.
Now I need to know if there is a program out there already that can connect to the com1 port, and then read/respond to the device to download all the barcodes and quantities and then export this to a csv, or even if a simple command prompt bat file could do this?
After some testing earlier, I know the device needs to receive an ack in some way as it times out without this (I could manually do this by sending %0 on a regular basis).
Thanks in advance.

Test assembly code on a mac

A while back I was following some tutorials an assembly. I was running it all on a windows machine, compiling with NASM and then writing the compiled code to a floppy disk, then reboot and try the code. This process was long and time consuming and sadly was not on a mac. When I found out that Xcode for mac installed NASM I immediately tried to compile some code. The code compiled fine. The issue is testing it. On a mac I have no floppy (not like I want to use one) so Im not sure how to test this. I looked in to Q (kju) and found it would only emulate things on an ISO file. So I guess what Im asking is is it possible to install the compiled code on an ISO file for testing? (Note: the code when compiled forms a .bin file)
Thanks for any help
I don't know exactly what you are trying to test (a boot loader maybe?) but you don't need to reboot or boot from a disk just to run assembled code (unless it is a boot loader or something).
Either way, if you need to "reboot" to test, I suggest running an emulator. Sun VirtualBox is super easy to use and free and emulates a standard x86 architecture (including floppy drives)! So that may work for you in the short term. If you ever want to create an ISO image in the future, you can do that with the command line utility hdiutil. In a terminal window, type man hdiutil or visit the online man page for more information on using that to create all kinds of disk images.

CodeWarrior for FreeScale trying to debug a simple program using the 56800E simulator

I'm just getting started learning FreeScale DSCs (MC56F800x series). I've done some work with AVRs using both AVR Studio on Windows and Eclipse and avr-gcc on Linux. CodeWarrior is just not as intuitive.
Right now I'm stuck trying to debug a simple program. I start the debugger using the built-in simulator, but it never reaches the first line of main(). Instead it seems to get stuck in some initialization code (MC56F8006_init.asm), specifically this line:
;; Loop until OCCS_STAT[LCK0] = 1
wait_for_lock:
brclr #OCCS_STAT_LCK0,x:>OCCS_STAT,wait_for_lock
I've let it run for quite a while and it never gets past this. It's obviously waiting for something, but what? You would think the simulator would just work... argh. Maybe there's some options I can change to make it pass this step?
I'm going to keep digging and will post an answer here if I find it first.
Updates:
Here's what I've found:
OCCS
On Chip Clock Synthesis
brclr
Branch if Bits Clear
The instruction loops until OCCS_STAT LCK0 is set. This register means the on-chip oscillator's PLL has locked (waits for clock stabilization).
I'm still not sure why the simulator spins forever on this line, and how I can solve this without resorting to hacking up the init code (which is part of the code library and not within my project).
I am not familiar with the part or the simulator, but it seems likely that the simulator is instruction-set-only and does not simulate the PLL hardware.
In most embedded development systems, the run-time startup code is provided as source and you could modify it (or rather make a local copy in your project and assemble and link that to override the default start-up). Alternately you could simply place a breakpoint in this loop, and advance the program-counter register to get it out of the loop. In many debuggers it is possible to attach a script to a breakpoint to do this automatically.

Resources