Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

nRF24AP2 with MSP430F1232 Communication Problem

Rank

Total Posts: 15

Joined 2013-09-03

PM

Hi there,
first of all let me thank you for your well moderated forum. I didn't post before but have been reading stuff and instructions which were really helpful so far.

If got a question concerning my development around an ANT nRF24AP2.

My system:
- Code Composer Studio 5.5
- Olimex MSP430-JTAG-TINY-V2
- Olimex MPS430P123M (with MSP430F1232)
- AP281M5IB (with nRF24AP2)


My Idea/Object:

My first object is to simple get the communication between mcu and ANT chip running.

I followed the instructions for the pinlayout and want to use "Synchronous messaging with byte flow controlI".
My source for that was the "nRF24AP2_Product_Specification_v1_2.pdf".

All connections are physically tested.

For programming i used, as often mentioned here, the code examples in the download section (Weight Scale).



But let me explain my problems:

1.

Using the example code and adding it step-by-step to my project i get the following error:
"error: program will not fit into available memory. run placement with alignment fails for section ".stack" size 0x28 [...] RAM size:0x100 unused: 0x16 max hole: 0x16".

I can get rid of this error by reducing the "Set C system stack size" from 80 to 12 (found in the project properties under MSP430 Linker -> Basic Option").

I don't know if that is the correct way to deal with that kind of error. It would be nice if someone could explain that to me.

2.

By using byte sync mode i should be able to see (via hardware scope) the communcation from host to mcu and vice versa. But neither the SCLK than SIN or SOUT do anything. What bothers me the most is that i can't get a CLK signal from the ANT chip.

I hope anyone of you out there is able to see my problem and give me instructions or some helpful advices.

Is there a minimal program for testing the communcation between the host and ANT chip?

Thanks in advance
and have a nice week.

Holger


Edit: One more:
3.
For Byte Sync Mode: SEN should be High at the beginning and only after I sync the MCU with the ANT Chip it should be low, am I right? (acording to the nRF24AP2 TimingDiagramm)
What could be the problem, if the signal is always low?

Thanks again.
Holger




     
RankRankRankRank

Total Posts: 156

Joined 2013-01-07

PM

Hi,

Responses to your questions:

1. I would refer to the TI MSP430 forum for a TI specific question like this. That would probably be the best source to get accurate information.

2. I'm not sure if you have had a chance to read through the Interfacing with ANT General Purpose Chipsets and Modules document (http://www.thisisant.com/resources/interfacing-with-ant-general-purpose-chipsets-and-modules/). Sections 3.5 and 3.6 explain the Sychronous Messaging with Byte Flow messaging scheme. You should look for the SCLK signal after the ANT module asserts SEN (your 3rd question) and the MCU asserts SRDY.

3. Are you resetting the ANT module after the MCU powers up? Read through section 3.4 of the same Interfacing document.

Also please verify that you have hooked up the MCU as specified in the AP2 RF Transceiver Module Data Sheet (http://www.thisisant.com/resources/ant-ap2-transceiver-module-datasheet/) , Section 1.3.2.      
Rank

Total Posts: 15

Joined 2013-09-03

PM

Hi again,
and thanks for the answer.

I did read through a lot of these instructions and do know how it 'should' work wink

In fact I just build another protoboard with ASYNC Com. between MCU and nRF24AP2.

My problem is, that the interrupt for the communication between those two does not seem to work.
Is there any rooky mistake I could have done during the configuration?

All pins should be configured and connected correctly. The Interrupt register etc. also seem to be configured right.

I an usb board from the ANTAP2DK1 running and with that I can see how the async uart ports should communicate. For all I know, they do exactly the same like my own prototyp should do.


How precise does the timing of my mcu has to be? Could there be a problem if it's not exactly the frequency the example code uses?

I hope someone can help me here smile

Thanks
Holger      
Rank

Total Posts: 15

Joined 2013-09-03

PM

Hi there again,

some update on my development:

Now I get a response / message from the AP2.
In hex: A4 80 6F 81 6B -> meaning I get the StartUp Message

For all I know this means I connected the AP2 correctly and my chip is working.

The problems above are still exisiting.

Still counting on your help wink

Have a nice weekend!

Holger      
RankRankRankRank

Total Posts: 156

Joined 2013-01-07

PM

What frequency are you using?      
Rank

Total Posts: 15

Joined 2013-09-03

PM

Hi there,

I want to use 8 MHz, the native max speed of the MCU.

My settings in CCS5:

SYSTEM_DCOCTL MAX_MCLK_FREQ;
SYSTEM_BCSCTL1 = (RSEL0 RSEL1 RSEL2 XT2OFF);
SYSTEM_BCSCTL1 &= ~SYSTEM_XTS;    
SYSTEM_BCSCTL1 &= ~(SYSTEM_DIVA0  SYSTEM_DIVA1); 
SYSTEM_BCSCTL2 |= DIVS_3


According to the family sheet this should get me 8 MHz.

I made it possible to change the baudrate from 57600 to 2400 by setting a different jumper.
For testing both versions should work i guess.

Thanks
Holger
     
Rank

Total Posts: 15

Joined 2013-09-03

PM

Progress Update:

I came to the point where both parts (Host and AP2) are sending messages.

The AP2 does sends the 'Start Up Sequence' and after the RTS signal is set to low, my host starts sending the sequence for setting the Network Key.

My problem now is that the RTS signal stays low after the sequence is complete.
What could be the problem here?

In hope of help
Holger

PS: I attached a file. Yellow is the UART TX (from HOST) and blue is the RTS (from AP2)      

Image Attachments

TEK0005.JPG

Click thumbnail to see full-size image

RankRankRankRank

Total Posts: 156

Joined 2013-01-07

PM

What is the content of the message you are sending to the AP2? Could you verify that the checksum and message formatting is correct?      
Rank

Total Posts: 15

Joined 2013-09-03

PM

Hi there,

I checked the UART config and the bit flow. Result: I did not set it correctly.
Instead of 8-bit I had 7-bit set.Thanks for suggesting it!

For those who are curious, the first line was set to "0", which is false for ANT UART.
UART_ASYNC_UCI_CTL0 CHAR;   // Configure UART no parity, LSB first, 8-bit, one stop bit
UTCTL0 |= SSEL0;   // UCLK = ACLK 


My next step: Getting the channel to open. I'll keep you posted!
     
Rank

Total Posts: 15

Joined 2013-09-03

PM

Update:

Now that I think the AP2 understands my messages I tried to get the channel open.

For that I tried different combinations.

1.

According to the ANT Message Protocol and Usage Section 5.3 "Establishing a channel" I started with setting the Network Key:

A4 -> 09 -> 46 -> [01] -> [B9] [A5] ... [45] -> E5

While I start sending this via UART, the AP2 answers with the Start Up Sequence:

A4 -> 08 -> 6F -> 18 -> 2B

So far so good.

But after the sequence for setting the network ID is completely transmitted the AP2 answers with:

A4 -> A0 -> 02 -> 80 -> 62 -> 00 -> 05

What I don't understand is the ID "02". What does that indicate?

2.

Following the example code I only assing the channel ( Fig. 5-3 outlined ), set the Channel ID and then tried to open the channel.

But as in (1.) I get an answer with msg ID "02".

If someone would be so kind to help me again smile
     
Rank

Total Posts: 15

Joined 2013-09-03

PM

Hi there, good news.

Forget the wrong msg ID from above.

I managed to get the channel open! I don't really know what did the trick in the end, but checking every single step of my program worked wonders.

After setting the necessary parts I frequently get the UART Answer:

[A4] [03] [40] [00] [01] [03] which stands for EVENT_TX (successful).

Which leads me with another question:
I also have the ANT AP2DK1. There is an USB Board included which should be able to receive my messages. I've set up ANTware II and established an RF communication between two USB moduls. So the USB modul is working.

My own prototype is definitly sending broadcast messages. I also tried different channel, device, etc. setting but none of them seem to change the receiving part. Any suggestions here?

One more thing:
It looks like my prototype isn't able to receive and interprete the answer from the AP2. The UART buffer and the interrupt do work, but if I follow the correct routine (like in the example codes) I can't get the channel open, because I don't get to the point where my prototype receives and shedules the correct msg (RESPONE_NO_ERROR).

The code segment I'm talking about:

case RESPONSE_NO_ERROR:
 
{   
   
if (pucEventBuffer_[3] == MESG_OPEN_CHANNEL_ID)
 
{
   IOBOARD_LED3_OUT 
&= ~IOBOARD_LED3_BIT;               // Turn ON LED  
   
printf("Initialization is complete.\n");
}
   
else if (pucEventBuffer_[3] == MESG_NETWORK_KEY_ID)
{
//Once we get a response to the set network key
//command, start opening the Weight Scale channel
WGTTX_Open(WGTTX_CHANNEL, (USHORTWGTTX_SERIAL_NUMBERWEIGHT_TX_TYPE); 


To clarify: I don't follow the subroutine from above. Instead I send the UART commands to assign the channel, wait a while, and then send the following commands to get the channel open and start transmitting broadcast messages.

Thanks so far and have a nice weekend

Holger
     
Avatar
RankRankRankRank

Total Posts: 235

Joined 2012-08-31

PM

Hi Holger,

If the channel IDs match, the network keys match, one device is configured as master and one as a slave it should all work.

I'd check the 'why won't my devices connect' FAQ here: http://www.thisisant.com/developer/resources/tech-faq/category/basic-troubleshooting/

Kat      
Rank

Total Posts: 15

Joined 2013-09-03

PM

Good morning,

thanks to your reply Kat i checked the channel settings again and did get it running. smile

Now my only problem is, that I don't receive the UART messages correctly on the mcu side. The flag for overrun is set. This flag is set, when the FIFO is not cleared before another byte is received. Looks like my UART RX Interrupt is not working. Any Ideas what could be the mistake there?

My UART Settings:

UART_ASYNC_UCI_CTL0 CHAR;       // Configure UART no parity, LSB first, 8-bit, one stop bit
UTCTL0 |= SSEL0;                          // UCLK = ACLK

// Baud rate
UART_ASYNC_UCI_BR0 asBaudControl[ucBaudRate_].ucBR0;    // set to 0D for 2400
UART_ASYNC_UCI_BR1 asBaudControl[ucBaudRate_].ucBR1;   // set to 0
UART_ASYNC_UCI_MCTL asBaudControl[ucBaudRate_].ucMCTL// set to 6B for ACK

ASYNC_RX_SEL |= ASYNC_RX_BIT;                   // Enable pin as UART RX
ASYNC_RX_DIR &= ~ASYNC_RX_BIT;                  // Enable pin as input  

ASYNC_TX_SEL |= ASYNC_TX_BIT;                   // Enable pin as UART TX
ASYNC_TX_DIR |= ASYNC_TX_BIT;                   // Enable pin as output

 
ME2 |= UTXE0 URXE0;                       // Enabled USART0 TXD/RXD

UART_ASYNC_UCI_CTL0 &= ~SWRST;                 // Enable UART

UART_ASYNC_UCI_IFR &= ~UART_ASYNC_RX_INT;       // Clear the RX interrupt
UART_ASYNC_UCI_IER |= UART_ASYNC_RX_INT;        // Enable the RX interrupt 

     
RankRankRankRank

Total Posts: 156

Joined 2013-01-07

PM

Hi,

I would also try the TI MSP430 forum for an MCU specific question like that: http://e2e.ti.com/support/microcontrollers/msp430/f/default.aspx .

It can be difficult to reproduce hardware specific problems like this without having more knowledge about your set up and being familiar with the exact CPU you are using.

Let me know if you have any more ANT questions pop up, I would be happy to help. smile

     
Rank

Total Posts: 15

Joined 2013-09-03

PM

Thanks usamak,

the AP2 is working fine so far. I receive and transmit the way I want it. So no more ANT problems here.

The remaining problems are software only and MSP related.

Thanks again and have a nice weekend!
- Holger