1-Wire on Q24Plus?


#1

Hi everyone,

I am trying to implement a 1-Wire iButton (DS18B20) with my Q24Plus module on a WISMO02 Development Board. I am “pin-bashing” GPIO4 which corresponds to the ADL_IO_Q24PLUS_GPIO_4 pin. However I am finding that the fastest I can get from the Q24Plus is 2.198kHz @ 2.8V but I need at least a 1MHz signal for 1-Wire.

Not only does the Q24Plus generate this slow signal (2.198kHz), it can only generate it for 10 seconds before the program crashes. I then have to restart the program by autodetecting it in Terminal Emulator.

The timer() method is indirectly called from the Keyboard handler via the hello() method. I wanted to make sure that the Keyboard handler can call any method. I was having the same problem when I was calling the timer() method directly from within it.

The boolean “flag” is unset using the Keyboard Handler.

void timer()
{
    //TRACE (( mcs_TraceLevel, "Inside the timer method at the beginning"));
    
    s8 returnCode;
    flag = TRUE;
    //int count = 0;    
    while(flag){
        //if (count == 1){
            if (toggle == 0x00000000)
                toggle = ADL_IO_Q24PLUS_GPIO_4;
            else
                toggle = 0x00000000;
            returnCode = adl_ioWrite(gpioHandle, ADL_IO_Q24PLUS_GPIO_4, toggle);
            /*count = 0;
        }
        count++;*/
    }
    //TRACE (( mcs_TraceLevel, "Inside the timer method at the end"));   
}

void hello(){
    TRACE ((mcs_TraceLevel, "Hello from hello() method"));
    adl_atSendResponse(ADL_AT_UNS, "Hello from hello() method\r\n");
	timer();
}

OUTPUT from Terminal Emulator:

Open AT: timer started //my comments: started timer
Hello from hello() method 

+WIND: 0 // my comments: program crashes

+WIND: 7
kïýkïÿ     ¨   °   ¸   À   È   Ð   Ø   à   è   ¼Open AT: timer started // my comments: restarted program then restarted timer.
Hello from hello() method

+WIND: 0 // my comments: crash again.

+WIND: 7

I didn’t find anything in the documentation about the clock rate on the Q24Plus but I think that it should be capable of generating a 1MHz signal so there must be something wrong with my code. Either that or there is a setting that I have overlooked.

Any or all constructive comments are welcome.

Thank you,

Francis.


#2

See: viewtopic.php?f=11&t=374&p=6943&hilit=wire#p6943

That’ll be because you’re using timing loops, so the Watchdog is causing the reset.
See the ADL User Guide.

Remember that Open-AT is just one thread running within the Q24 - if it hogs the CPU, the GSM stack cannot run…

What makes you think that?

I don’t think even the RealTime features of the latest Open-AT releases can go nearly fast enough!


#3

Hi Awneil,

Thank you for the speedy reply. I am new to programming microcontrollers and still learning.

I am using the MultiApp library which hopefully means that my program should run more than one application (thread?). This MultiApp library came with the sample programs bundled with OpenAT 3.19.

The reason why I thought the Q24Plus “should be capable of generating a 1MHz signal” was because of a quote in the datasheet WM_PRJ_Q24NG_PTS_001-004, p28 entitled “PTS_Q24_Series” but it is with reference to the SPI Bus where it reads “The frequency clock is programmable from 812kHz to 13MHz.” Surely if the Q24 can generate a clock signals within that range, it could do 1MHz.

Anyway thank you Awneil for the helpful tips, much appreciated.

Regards,

Francis.


#4

It seems that the 1-wire protocol can be implemented directly using … a simple UART. The full explanation can be found in the datasheet of the Atmel AVR318
atmel.com/dyn/resources/prod … oc2579.pdf
I am interested to know if it works…


#5

What is your previous programming experience?
Using terms like “method” suggests that you have previously used C++ - yes?

No, it doesn’t, I’m afraid.

Multiapp just allows you to combine several “applications” into a single downloadable image - and that runs in the single Open-AT thread.

That is using the modules dedicated SPI hardware - not generating a clock from an Open-AT application!

It’s a bit like saying that a PC has so many GHz clock rate - that doesn’t mean that a VB program can toggle a line at 1MHz!


#6

Actually, the technique is described in an Application Note on the Maxim/Dallas site.

I suggest that you start from the source document (on the Maxim/Dallas site) rather than someone else’s interpretation of it (the datasheet of the Atmel AVR318).

But I’m not sure if Open-AT will give you close enough control of the UART to do this…?


#7

Hey guys,

Bbo, thanks for pointing me in the right direction. I am looking at the AVR318 document now.

True Avneil, I am also looking at the Maxim Application Note 192 for using a UART. To use their userial lib (in the 1-Wire Public Domain Kit) the UART needs to use at least a DS2408B Serial 1-Wire Line Driver.

Regards,

Francis.


#8

No, that one’s about using the DS2408B “bridge” chip.

I was thinking of APPLICATION NOTE 214, Using a UART to Implement a 1-Wire Bus Master:

maxim-ic.com/appnotes.cfm/appnote_number/214
That is probably the basis for the Atmel document…

Again, I’m not sure that Open-AT gives you sufficient control of the UART - so you may still need to use a “bridge” chip like the DS2408B, or one of the others mentioned earlier, or a separate microcontroller…


#9

Hi Aveneil,

Sorry, I haven’t sent a recent reply. Thanks for the heads up.

I have put aside the 1-Wire for now so I can first work on capturing GPS data through UART2 and send it as SMS. Then capturing image data and sending that. Finally I will come back to the 1-Wire in about two weeks time.

Regards,

Francis.