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.

problems using __data16_write_addr()

Other Parts Discussed in Thread: CC430F5137

I'm currently trying to set up Spi using the DMA however I am encountering a problem with using __data16_write_addr(). The function that I am using is:

void SetupDMA0( volatile uint8_t *SourceAddress, uint8_t NumberOfBytes )
{

	__data16_write_addr( (unsigned short) &DMA0SA, (unsigned long) SourceAddress );			/* Source address */
	__data16_write_addr( (unsigned short) &DMA0DA, (unsigned long) &UCB0TXBUF );	/* Destination Block address */



	DMACTL0		= DMA0TSEL_19;																/* Set USCIA0 Transmit, DMA0TSEL_17 as the trigger */
	DMA0CTL		= DMASRCINCR_3 | DMASBDB | DMADT_0 | DMALEVEL |  DMAIE;		/* Single Transfer Mode, Source Address Incremented */
																			/* Destination Address Fixed, Source Byte to Destination Byte, */
																			/* Edge (Rising) Sensitive Triggers, DMA1 Disabled */
																			/* Interrupt Enabled,  DMALEVEL too */
	DMA0SZ  = NumberOfBytes;												/* Block Size */
}

however upon compiling I am getting a waring informing me that __data16_write_addr() is being declared implicitly. This presumably means that I'm not including a required file, however when looking at example code the only file include at the top is "msp430.h" which I am also including. I also tried including "intrinsics.h" specifically but that didn't help either.


Does anyone have any ideas what might be going wrong?

  • What specific MSP430 are you compiling your code for?

  • Ok, I asked because I was wondering if you might be hitting this issue:

    http://e2e.ti.com/support/microcontrollers/msp430/f/166/t/241610.aspx

    The data16/data20 instrinsics are only available on the 430X CPU core, not the plain 430. The cc430f5137 datasheet says it has an XV2 CPU, so that should be fine from a hardware point of view.

    I don't have any experience with the 430X core - could it be that you need to enable a compiler setting to allow use of the extended instruction set?

  • The specific write functions are so-called intrinsics. There shouldn’t be any need to include a header file, as the compiler knows them as if they were C keywords.
    And yes, the CPU supports the 20bit asembly instructions they should generate.

    Maybe you have a problem with the project setup and the compiler thinks the CPU doesn't have a 20 bit core. Did you copy the project over from an older compiler?

    However, for DMA0DA, this is superfluous anyway, as TXBUF is in lower 64k (has a 16 bit address) and doesn’t need a 20bit write at all.
    DMA0DA = (unsigned int)(& UCB0TXBUF); will do fine.

    For the source address, well, if you use small data model, then uint8_t* is a 16 bit value too (pointing to data in lower 64k) and no intrinsic is needed for writing to DMA0SA as well.

    You only need the address intrinsic when needing to write a 20 bit address value as one single write operation (which is only necessary for programming the DMA for accessing memory above 64k).

    You didn’t write which IDE you use. For the CCSV4.x compiler and newer, your code should have compiled (and done the expected job, even though unnecessarily complex)

**Attention** This is a public forum