This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Readback of Configuration registers of AM335x PRU (Beaglebone Black)

Hello everyone,

I am using the Beaglebone Black and my target was to do some Digital/Analog conversion with the PRU (because of high speed data output). The DAC is adressed with the McSpi device.

I have the current PRU-C-Compiler (cgt-pru_2.1.1), on a Ubuntu 14.04.1.

My Programm is based on the following example:

(exaclty: /example/pruss_c) but i dont use any of the code i just use the buildenviroment (./build.sh) and after the build is done i just copy the text.bin, data.bin and main file to the Beaglebone Black. I have attached a compiled version and the sources at the end.

So now to the thing where the problems begin, this is my PRU programm

#define gpio 0x4804C000
#define setdata 0x194
#define cleardata 0x190

// SPI Register Definitions
#define McSPI1 0x481A0000
#define McSPI_SYSCONFIG 0x110
#define McSPI_SYSSTATUS 0x114
#define SPI_SYSCFG (*(volatile unsigned long *) (McSPI1 + McSPI_SYSCONFIG))
#define SPI_SYSSTATUS (*(volatile unsigned long *)(McSPI1 + McSPI_SYSSTATUS ))

volatile register unsigned int __R31;

int main(void)
{
	// init OPC Master
	__asm__ __volatile__
	(
		" LBCO &r0, C4, 4, 4 \n"
		" CLR r0, r0, 4 \n"
		" SBCO &r0, C4, 4, 4 \n"
	);
	// Set softreset of SPI modul
   SPI_SYSCFG =  SPI_SYSCFG | 0x2;
   // Readback reset status and wait until done
   while(SPI_SYSSTATUS == 0)
   {
// Light USR LED (*(volatile unsigned long *)(gpio|setdata)) =1 << 21; __delay_cycles(30000000);
  // Clear USR LED (*(volatile unsigned long *)(gpio|cleardata)) =1 << 21; __delay_cycles(30000000); } __R31 = 35; __halt(); return 0; }

What i wantet to do is to reset the McSPI device of the AM335x and just exit when its done, and while i am waiting it should flash one LED.

I can run the program fine but it just never finishes, the LED keeps flashing and there sems to be just nothing in the SPI_SYSSTATUS register there is never a 1 in it as it is supposed, written in the Referenve Manual Page 4816.

I have all files needed to buld the programm attached , but you have to alter the build.sh ( export PRU_CGT_DIR=/home/sfa/pru_compiler/ ) and change the path to the pru compiler, and then just run ./build.sh from the shell.

I hope you can help me with this and mabey tell me where i took a wrong turn

Greetings Stefan

PRU_C.zip