S32K146 LPSPI with ADXL314

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32K146 LPSPI with ADXL314

Jump to solution
732 Views
Khaledag
Contributor II

Hey, 

I'm trying to setup the S32K146 with an ADXL314 sensor to read the XYZ values, but I'm having a bit of a problem with the SPI settings, this forum has been very helpful with a lot of my questions, and I guess I made good progress so far, but still I find myself stuck now.

So my code looks like this: 

The Transmit once function is finally working, it took me a few hours to figure it out. but I believe I now have problems with the Receiving function: 

LPSPI0.png

I'm trying to do something like this code that i found for the STM32, and it worked fine on it: 

STM32 .png

The ADXL has 6 bytes after one another that contain the values of XYZ, and i cant figure out how to get the S32K146 to read those bytes in a good manner. 

I'm a little bit lost here, so please help

0 Kudos
1 Solution
398 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

use receiveBytes(&rx_buffer[0],6) and *buffer++ = LPSPI0->RDR; inside receive function
It would work normally.

BR, Petr

 

View solution in original post

0 Kudos
14 Replies
712 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

you should do a read in following manner

- pull the CS low to enable the slave
- transmit the address from where we want to read data (check TDF flag and put data to TDR, clear TDF)
- receive data. 6 bytes in this case, so repeat below 3 times
check TDF flag and put dummy data to TDR
check RDF flag and read data from RDR, save it to buffer, clear TDF and RDF
- pull the CS pin high to disable the slave

BR, Petr

0 Kudos
696 Views
Khaledag
Contributor II
  Thanks for your answer, do you mean like this? : 


  PTB-> PCOR |= (1 << 5); // CS LOW
 
  while((LPSPI0->SR & LPSPI_SR_TDF_MASK)>>LPSPI_SR_TDF_SHIFT==0) {}
  LPSPI0->TDR =  LPSPI_TDR_DATA(0xf200) ;
  LPSPI0->SR |= LPSPI_SR_TDF_MASK; /* Clear TDF flag */
 
 while((LPSPI0->SR & LPSPI_SR_RDF_MASK)>>LPSPI_SR_RDF_SHIFT==0);
 recieve= LPSPI0->RDR; /* Read received data */
 LPSPI0->SR |= LPSPI_SR_RDF_MASK; /* Clear RDF flag
 
 while((LPSPI0->SR & LPSPI_SR_TDF_MASK)>>LPSPI_SR_TDF_SHIFT==0) {}
 LPSPI0->TDR =  LPSPI_TDR_DATA(0x0000) ;
 
while((LPSPI0->SR & LPSPI_SR_RDF_MASK)>>LPSPI_SR_RDF_SHIFT==0);
 recieve= LPSPI0->RDR; /* Read received data */
 LPSPI0->SR |= LPSPI_SR_RDF_MASK; /* Clear RDF flag
 
 while((LPSPI0->SR & LPSPI_SR_TDF_MASK)>>LPSPI_SR_TDF_SHIFT==0) {}
 LPSPI0->TDR =  LPSPI_TDR_DATA(0x0000) ;
 
while((LPSPI0->SR & LPSPI_SR_RDF_MASK)>>LPSPI_SR_RDF_SHIFT==0);
 recieve= LPSPI0->RDR; /* Read received data */
 LPSPI0->SR |= LPSPI_SR_RDF_MASK; /* Clear RDF flag
 
  while((LPSPI0->SR & LPSPI_SR_TCF_MASK)>>LPSPI_SR_TCF_SHIFT==0) {}
  LPSPI0->SR |= LPSPI_SR_TCF_MASK;
 
 
  PTB-> PSOR |= (1 << 5); // CS HIGH
0 Kudos
629 Views
Khaledag
Contributor II

Sorry, I mean like this? 

#define CS_PIN 5

// Function to read data from SPI
void readDataFromSPI(uint8_t address, uint8_t* receivedBuffer) {
    // Pull CS low to enable the slave
    PTB->PCOR |= (1 << CS_PIN); // CS LOW

    // Transmit the address from where we want to read data
    // Wait for TDF flag to be set
    while (!(SPI_MODULE->SR & LPSPI_SR_TDF_MASK)>> LPSPI_SR_TDF_SHIFT == 0));

    // Transmit address data
    SPI_MODULE->TDR = LPSPI_TDR_DATA(address);
    
    // Clear TDF flag
    SPI_MODULE->SR |= LPSPI_SR_TDF_MASK;

    // Receive data. 6 bytes, repeat 3 times
    for (int i = 0; i < 3; ++i) {
        // Check TDF flag and put dummy data to TDR
        while (!(SPI_MODULE->SR & LPSPI_SR_TDF_MASK)>> LPSPI_SR_TDF_SHIFT == 0);
        
        // Transmit dummy data
        SPI_MODULE->TDR = LPSPI_TDR_DATA(0x00);

        // Check RDF flag and read data from RDR, save it to buffer, clear TDF and RDF
        while (!(SPI_MODULE->SR & LPSPI_SR_RDF_MASK)>> LPSPI_SR_RDF_SHIFT == 0);
        
        receivedBuffer[i * 2] = SPI_MODULE->RDR; // Save received data to buffer (high byte)
        
        // Clear TDF and RDF flags
        SPI_MODULE->SR |= LPSPI_SR_TDF_MASK | LPSPI_SR_RDF_MASK;

        // Check TDF flag and put dummy data to TDR
        while (!(SPI_MODULE->SR & LPSPI_SR_TDF_MASK)>> LPSPI_SR_TDF_SHIFT == 0);
        
        // Transmit dummy data
        SPI_MODULE->TDR = LPSPI_TDR_DATA(0x00);

        // Check RDF flag and read data from RDR, save it to buffer, clear TDF and RDF
        while (!(SPI_MODULE->SR & LPSPI_SR_RDF_MASK)>> LPSPI_SR_RDF_SHIFT == 0);
        
        receivedBuffer[i * 2 + 1] = SPI_MODULE->RDR; // Save received data to buffer (low byte)
        
        // Clear TDF and RDF flags
        SPI_MODULE->SR |= LPSPI_SR_TDF_MASK | LPSPI_SR_RDF_MASK;
    }

    // Pull CS pin high to disable the slave
    PTB->PSOR |= (1 << CS_PIN); // CS HIGH
}

int main() {

    // Define the buffer to store received data
    uint8_t receivedDataBuffer[6];

    // Read data from SPI at address 0xf2
    readDataFromSPI(0xf2, receivedDataBuffer);

    return 0;
}

 

I would really appreciate it if you'd also tell me exactly where the mistakes are, thank you.

0 Kudos
603 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

it could be. Not sure why there is twice a same in for loop. If SPI is set to sent 8bits then you will repeate it 6times, for 16bit 3 times.
Measure SPI lines with scope/analyzer to know what is generated.

BR, Petr

0 Kudos
589 Views
Khaledag
Contributor II

Thanks again for the answer, the program gets stuck at this line, at the first loop it makes. 
and yes the requested data are 6 * 8bits
stuck.png

0 Kudos
576 Views
Khaledag
Contributor II

So I believe the problem so far is this: 
I cant senf 2 8bit addresses  after one another, I can only send 16 bit .. but I need to receive 8 bit for each byte Im reading and I can only receive 16bit which makes the values all wrong and if i change frames to 7 (7+1 bit).. everything goes broken. 

Adxl.png

 

this is what I need to do. 
Also the code I sent doesnt work, maybe i got the steps wrong that you wrote? or maybe you could test it . 
the code that works on the scope is this, but again, the received data are false: 

nxp_1.pngnxp_2.png

 

but putting them in a loop isnt working 

 

0 Kudos
568 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

so what is seen on working code on SPI lines and what is received in x,y,z variables?
Receive functions does not have input parameters, but you call them with some.

BR, Petr

0 Kudos
559 Views
Khaledag
Contributor II

It works, i just cant activate the multibyte read or write. 

this is the code so far, its working but im pretty sure im receiving some of the bytes false: 


0 Kudos
510 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

if handling CS using GPIO pin then below code can be used, I think. Assuming TCR was set for 8bit frames

uint8_t rx_buffer[20];

void LPSPI1_receive(uint8_t address, uint8_t *rxBuf, uint8_t nbytes)
{
PTB-> PCOR |= (1 << 5); // CS LOW
while((LPSPI1->SR & LPSPI_SR_TDF_MASK)>>LPSPI_SR_TDF_SHIFT==0){};
LPSPI1->TDR = 0xC0|address;
while((LPSPI1->SR & LPSPI_SR_RDF_MASK)>>LPSPI_SR_RDF_SHIFT==0){};
(void)LPSPI1->RDR;
do
{
while((LPSPI1->SR & LPSPI_SR_TDF_MASK)>>LPSPI_SR_TDF_SHIFT==0);
LPSPI1->TDR = nbytes; // write dummy byte
while((LPSPI1->SR & LPSPI_SR_RDF_MASK)>>LPSPI_SR_RDF_SHIFT==0);
*rxBuf++ = LPSPI1->RDR;
}while(nbytes-- > 1);
PTB-> PSOR |= (1 << 5); // CS HIGH
}
 
LPSPI1_receive(0x32,&rx_buffer[0],6);
 
Otherwise if LPSPI should handle CS pin, continuous selection have to be used and code must be different.
 
BR, Petr
0 Kudos
476 Views
Khaledag
Contributor II

Thank you very much.. 

Yes I have took control over the CS pin and it toggles as wanted.
I still have one more Problem that comes up while running this code: 

void LPSPI1_receive(uint8_t address, uint8_t *rxBuf, uint8_t nbytes) {
// Lower Chip Select (CS) pin
PTB->PCOR |= (1 << 5); // Assuming Chip Select pin is connected to PTB5

// Wait until Transmit Data Flag (TDF) is set
while (((LPSPI0->SR & LPSPI_SR_TDF_MASK) >> LPSPI_SR_TDF_SHIFT) == 0) {}

// Send command byte with address
LPSPI0->TDR = address;

// Wait until Receive Data Flag (RDF) is set
while (((LPSPI0->SR & LPSPI_SR_RDF_MASK) >> LPSPI_SR_RDF_SHIFT) == 0) {}

// Clear the Receive Data Register
(void)LPSPI0->RDR;
LPSPI0->SR |= LPSPI_SR_RDF_MASK; /* Clear RDF flag */

// Loop to receive nbytes of data
for (; nbytes > 0; nbytes--) {
// Wait until Transmit Data Flag (TDF) is set
while (((LPSPI0->SR & LPSPI_SR_TDF_MASK) >> LPSPI_SR_TDF_SHIFT) == 0);

// Send dummy byte to trigger reception
LPSPI0->TDR = 0x00; // write dummy byte

// Wait until Receive Data Flag (RDF) is set
while (((LPSPI0->SR & LPSPI_SR_RDF_MASK) >> LPSPI_SR_RDF_SHIFT) == 0);

// Read received data and store it in the receive buffer
*rxBuf++ = LPSPI0->RDR;
}

when the first loop reaches this:

        *rxBuf++ = LPSPI0->RDR;

 
It crashes and sends me to this: 
image.png 

 

Any Idea whats wrong?

0 Kudos
462 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

assume pointer issue, does it point to right memory/place?

BR, Petr

0 Kudos
430 Views
Khaledag
Contributor II

This is where I am so far: 

#include "device_registers.h"           /* include peripheral declarations */
#include "LPSPI.h"
#include "clocks_and_modes.h"
#include <stdio.h>
#include <stdint.h> 

uint16_t x,y,z;
  float xg, yg, zg;
  uint16_t X_raw, Y_raw, Z_raw;
  int i;
  uint8_t rx_buffer[6];

void WDOG_disable (void)
{
	WDOG->CNT=0xD928C520;     /* Unlock watchdog 		*/
    WDOG->TOVAL=0x0000FFFF;   /* Maximum timeout value */
    WDOG->CS = 0x00002100;    /* Disable watchdog 		*/
}

void PORT_init (void)
{
	/*!
	 * Pins definitions
	 * ===================================================
	 *
	 * Pin number        | Function
	 * ----------------- |------------------
	 * PTB14             | LPSPI1_SCK
	 * PTB15             | LPSPI1_SIN
	 * PTB16			 | LPSPI1_SOUT
	 * PTB17			 | LPSPI1_PCS3
	 */
  PCC->PCCn[PCC_PORTB_INDEX ]|=PCC_PCCn_CGC_MASK; /* Enable clock for PORTB */
  PORTB->PCR[2]|=PORT_PCR_MUX(3); /* Port B2: MUX = ALT3, LPSPI1_SCK */
  PORTB->PCR[3]|=PORT_PCR_MUX(3); /* Port B3: MUX = ALT3, LPSPI1_SIN */
  PORTB->PCR[4]|=PORT_PCR_MUX(3); /* Port B4: MUX = ALT3, LPSPI1_SOUT */
//  PCC->PCCn[PCC_PORTB_INDEX ]|=PCC_PCCn_CGC_MASK; /* Enable clock for PORTB */
  PORTB->PCR[5] = 0x00000100; /* Port B5: MUX = GPIO */
  PTB->PDDR |= 1<<5; /* Port B5: Data Direction= output */
  PTB->PTOR |= 1<<5; /* toggle output port B5 */
  PTB-> PSOR |= (1 << 5);
}
int main(void)
{

	uint32_t counter = 0;
  WDOG_disable();		   /* Disable WDOG */
  SOSC_init_8MHz();        /* Initialize system oscillator for 8 MHz xtal */
  SPLL_init_160MHz();      /* Initialize SPLL to 160 MHz with 8 MHz SOSC */
  NormalRUNmode_80MHz();   /* Init clocks: 80 MHz sysclk & core, 40 MHz bus, 20 MHz flash */
  LPSPI1_init_master();    /* Initialize LPSPI 1 as master */
  PORT_init();             /* Configure ports */

  LPSPI1_write_addresses(0x31, 0x0f);
  LPSPI1_write_addresses(0x2d, 0x08);

for(;;)
  {
    receiveBytes(&rx_buffer, 6);
	  x = ((rx_buffer[1]<<8)|rx_buffer[0]);
	  y = ((rx_buffer[3]<<8)|rx_buffer[2]);
	  z = ((rx_buffer[5]<<8)|rx_buffer[4]);

 counter++;
  }
}

 

this is the main I'm using 

 

Now to the LPSPI:

/*
 * Copyright (c) 2014 - 2016, Freescale Semiconductor, Inc.
 * Copyright (c) 2016 - 2018, NXP.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 *
 * 3. Neither the name of the copyright holder nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 * THE POSSIBILITY OF SUCH DAMAGE.
 */

#include "device_registers.h"	  /* include peripheral declarations */

void LPSPI1_init_master(void)
{
	/*!
	 * LPSPI1 Clocking:
	 * ===================================================
	 */
	PCC->PCCn[PCC_LPSPI0_INDEX] = 0;          		/* Disable clocks to modify PCS ( default) 	*/
	PCC->PCCn[PCC_LPSPI0_INDEX] = PCC_PCCn_PR_MASK	/* (default) Peripheral is present.			*/
								 |PCC_PCCn_CGC_MASK	/* Enable PCS=SPLL_DIV2 (40 MHz func'l clock) 	*/
								 |PCC_PCCn_PCS(6);
	/*!
	 * LPSPI1 Initialization:
	 * ===================================================
	 */
  LPSPI0->CR    = 0x00000000;   			/* Disable module for configuration 			*/
  LPSPI0->IER   = 0x00000000;   			/* Interrupts not used 						*/
  LPSPI0->DER   = 0x00000000;   			/* DMA not used 								*/
  LPSPI0->CFGR0 = 0x00000000;   			/* Defaults: 									*/
                                			/* RDM0=0: rec'd data to FIFO as normal 		*/
                                			/* CIRFIFO=0; Circular FIFO is disabled 		*/
                                			/* HRSEL, HRPOL, HREN=0: Host request disabled */

  LPSPI0->CFGR1 = LPSPI_CFGR1_MASTER_MASK	/* Configurations: master mode									*/
  	  	  	  	  |LPSPI_CFGR1_AUTOPCS(0);
											/* PCSCFG=0: PCS[3:2] are enabled 								*/
											/* OUTCFG=0: Output data retains last value when CS negated	*/
											/* PINCFG=0: SIN is input, SOUT is output 						*/
											/* MATCFG=0: Match disabled 									*/
											/* PCSPOL=0: PCS is active low 								*/
											/* NOSTALL=0: Stall if Tx FIFO empty or Rx FIFO full 			*/
											/* AUTOPCS=0: does not apply for master mode 					*/
											/* SAMPLE=0: input data sampled on SCK edge 					*/
											/* MASTER=1: Master mode 										*/

  LPSPI0->TCR   = LPSPI_TCR_CPHA_MASK
//		  	  	  |LPSPI_TCR_WIDTH (16)
				  |LPSPI_TCR_PRESCALE(2)
//				  |LPSPI_TCR_PCS(1)
				  |LPSPI_TCR_CPOL(1)
				  |LPSPI_TCR_FRAMESZ(7);   /* Transmit cmd: PCS3, 16 bits, prescale func'l clk by 4, etc	*/
											/* CPOL=0: SCK inactive state is low 							*/
											/* CPHA=1: Change data on SCK lead'g, capture on trail'g edge	*/
											/* PRESCALE=2: Functional clock divided by 2**2 = 4 			*/
											/* PCS=3: Transfer using PCS3 									*/
											/* LSBF=0: Data is transfered MSB first 						*/
											/* BYSW=0: Byte swap disabled 									*/
											/* CONT, CONTC=0: Continuous transfer disabled 				*/
											/* RXMSK=0: Normal transfer: rx data stored in rx FIFO 		*/
											/* TXMSK=0: Normal transfer: data loaded from tx FIFO 			*/
											/* WIDTH=0: Single bit transfer 								*/
											/* FRAMESZ=15: # bits in frame = 15+1=16 						*/

  LPSPI0->CCR   = LPSPI_CCR_SCKPCS(4)
				  |LPSPI_CCR_PCSSCK(4)
				  |LPSPI_CCR_DBT(8)
				  |LPSPI_CCR_SCKDIV(8);   	/* Clock dividers based on prescaled func'l clk of 100 nsec 	*/
											/* SCKPCS=4: SCK to PCS delay = 4+1 = 5 (500 nsec) 			*/
											/* PCSSCK=4: PCS to SCK delay = 9+1 = 10 (1 usec) 				*/
											/* DBT=8: Delay between Transfers = 8+2 = 10 (1 usec) 			*/
											/* SCKDIV=8: SCK divider =8+2 = 10 (1 usec: 1 MHz baud rate) 	*/

//  LPSPI0->FCR   = LPSPI_FCR_TXWATER(3);   	/* RXWATER=0: Rx flags set when Rx FIFO >0 	*/
                                			/* TXWATER=3: Tx flags set when Tx FIFO <= 3 	*/

  LPSPI0->CR    = LPSPI_CR_MEN_MASK
		  	  	  |LPSPI_CR_DBGEN_MASK;   	/* Enable module for operation 			*/
											/* DBGEN=1: module enabled in debug mode 	*/
											/* DOZEN=0: module enabled in Doze mode 	*/
											/* RST=0: Master logic not reset 			*/
											/* MEN=1: Module is enabled 				*/
}

void LPSPI1_write_addresses(uint8_t address, uint8_t command) { 	// works like a charm

	address = address|0x40;  // multibyte write enabled
//	address = address|0x80;  // multibyte write enabled

	PTB-> PCOR |= (1 << 5); // CS LOW

	while ((LPSPI0->SR & LPSPI_SR_TDF_MASK) >> LPSPI_SR_TDF_SHIFT == 0);
	/* Wait for Tx FIFO available */
	LPSPI0->TDR = address; /* Transmit address 1 */
	LPSPI0->SR |= LPSPI_SR_TDF_MASK; /* Clear TDF flag */

	while ((LPSPI0->SR & LPSPI_SR_TDF_MASK) >> LPSPI_SR_TDF_SHIFT == 0);
	/* Wait for Tx FIFO available */
	LPSPI0->TDR = command; /* Transmit address 2 */
	LPSPI0->SR |= LPSPI_SR_TDF_MASK; /* Clear TDF flag */

	PTB-> PSOR |= (1 << 5); // CS HIGH

}


void receiveBytes(uint8_t *buffer, uint8_t numBytes)
{
	uint8_t i;
	PTB->PCOR |= (1 << 5); // CS LOW
	while((LPSPI0->SR & LPSPI_SR_TDF_MASK)>>LPSPI_SR_TDF_SHIFT==0) {}
    LPSPI0->TDR	 =  LPSPI_TDR_DATA(0xf2)	;
    LPSPI0->SR |= LPSPI_SR_TDF_MASK; /* Clear TDF flag */
    while((LPSPI0->SR & LPSPI_SR_RDF_MASK)>>LPSPI_SR_RDF_SHIFT==0){}
    LPSPI0->RDR	;
    LPSPI0->SR |= LPSPI_SR_RDF_MASK; /* Clear RDF flag */
	for (i = 0 ; i < numBytes; ++i) {
	  while ((LPSPI0->SR & LPSPI_SR_TDF_MASK) >> LPSPI_SR_TDF_SHIFT == 0) {}
	  LPSPI0->TDR = LPSPI_TDR_DATA(0x00);
	  while ((LPSPI0->SR & LPSPI_SR_RDF_MASK) >> LPSPI_SR_RDF_SHIFT == 0) {}
	  buffer[i] = LPSPI0->RDR;

	}
//	LPSPI0->SR |= LPSPI_SR_RDF_MASK; /* Clear RDF flag */
//    while((LPSPI0->SR & LPSPI_SR_TCF_MASK)>>LPSPI_SR_TCF_SHIFT==0) {}
//    LPSPI0->SR |= LPSPI_SR_TCF_MASK;

	PTB->PSOR |= (1 << 5); // CS HIGH
}

 

Now the LPSPI1_write_addresses function works pretty good, I am now able to send the 2 addresses while controlling the CS pin and I can see that on the Scope too.

but the Problem here is also happening in the loop of the receiveBytes function where the code crashes and gives me the same "Pointer issue". 
but I cant seem to figure out why. 
Any suggestions?  
I also get this error in the console: 
BusFault: An imprecise (asynchronous) data access error has occurred.
HardFault: A fault has been escalated to a hard fault.

Thanks in advance for your help

0 Kudos
399 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

use receiveBytes(&rx_buffer[0],6) and *buffer++ = LPSPI0->RDR; inside receive function
It would work normally.

BR, Petr

 

0 Kudos
456 Views
Khaledag
Contributor II

I checked everything else and I believe the pointers are working well. 
When I go step by step I achieve this line: nbytes--; and after that the crash happens. 
any idea what could be wrong? 
I tried it your way and also with a for loop but it doesnt work. 

Thank you for your troubles so far.

0 Kudos