Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

ARDUINO + D52QD2M4IA - protocol help…

RankRankRank

Total Posts: 54

Joined 2013-05-15

PM

Harrison - 03 October 2016 02:27 PM
Hi,

Sorry, it's a bit difficult without the common embedded debug tools to help. I can try to suggest a few things...

Do you ever assert the SLEEP or SUSPEND lines? You could try never asserting them (keeping them high) if you do use them now.


I check my Arduino application code. Line SLEEP and SUSPEND never asserting them - in start code are initial set to:
SLEEP = LOW
SUSPEND = HIGH
for all time.
From D52Q datasheet on page 26 (appendix A) SLEEP seems to be active HIGH (so HIGH means go in sleep mode) and SUSPEND seems to be active LOW (nSUSPEND so I think LOW means active).
Here is my code
// **************************************************************************************************
// *  ANT Management Routines
// **************************************************************************************************
void antBegin() {
  pinMode
(SUSPEND_PINOUTPUT);
  
pinMode(SLEEP_PIN,   OUTPUT);
  
pinMode(RESET_PIN,   OUTPUT);
  
pinMode(RTS_PIN,     INPUT);
  
//Per datasheet
  
digitalWrite(RESET_PIN,   HIGH);
  
digitalWrite(SUSPEND_PINHIGH);
  
digitalWrite(SLEEP_PIN,   LOW);
  
//This should not be strictly necessary - the device should always come up by itself....
  //But let's make sure we didn't miss the first RTS in a power-up race
  
hardwareReset();


Harrison - 03 October 2016 02:27 PM

How long do you wait after receiving the startup message? You could try waiting at least 500ms afterward.

From power-on to first UART message from D52Q to Arduino the time is about 1000ms (1 second) but I can check this time writing an appropriate Arduino routine. But we must give in mind that when Arduino powers-on in take about 800ms to start firmware and bootloader and after that it start program.

Harrison - 03 October 2016 02:27 PM

Have you tried an alternate interface such as SPI?

No I haven't tried SPI interface... could I?

Harrison - 03 October 2016 02:27 PM

Does the CRC come back correctly during those strings of messages?

Yes, somethimes I get back from D52Q a wrong CRC...

     
RankRankRank

Total Posts: 54

Joined 2013-05-15

PM

I try to measure module start-up time to get a first start-up message.
This is the debug output from Arduino:


ANT+ARDUINO
----------------------> Reset Executed: 1
started
rts_ant_received 1
MESSAGE_READ_ERROR_BAD_CHECKSUM
MESSAGE_READ_INFO_TIMEOUT_MIDMESSAGE
RX <<< [ A4 1 6F 1 C9 ] (get a startup message)
D52Q Starts Up In 370ms
     
Avatar
RankRankRankRank

Total Posts: 745

Joined 2012-09-14

PM

I would recommend trying the SPI as well as a sanity check, as the incorrect checksum's still indicate to me that there's probably some kind of framing error occurring.      
RankRankRank

Total Posts: 54

Joined 2013-05-15

PM

Hi,
I solved the issue setting UART speed rate to 9600bps.
I don't know why! If speed goes up to 19200bps sometimes some packets seems to be corrupted and at 38400 all packets becomes corrupted.
Thanks...