UART counts double?

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 7.

Moderator: Benj

Post Reply
MJU
Posts: 502
Joined: Wed Nov 07, 2007 6:51 pm
Location: Antwerp Belgium
Has thanked: 121 times
Been thanked: 108 times

UART counts double?

Post by MJU »

I'm trying to get a NRF24L01 working with the FC7 component.

This works with the UART component I think.
The last evenings I was trying to send just 1 number via the component, but when I watch what is send via the UART (logic analyser), I see that the number is doubled.

In the attached flowchart I see that the initialisation is done the correct way (looks familiar with the code I've written for V6) :-)
But, as soon as the random number is send (register 0 = 1) I read a "2" on the analyser.
Register 5 = 0x11, and the UART sends 0x22..

Again a timing error?
The strange thing is that the initialisation is done with the right settings:

0.100181937500000,SPI,MOSI: 0x24
1.387201750000000,SPI,MOSI: 0x4F
1.387204375000000,SPI,MOSI: 0x26
1.387248125000000,SPI,MOSI: 0x07
1.387250750000000,SPI,MOSI: 0x3C
1.387294562500000,SPI,MOSI: 0x00
1.387297187500000,SPI,MOSI: 0x27
1.387340937500000,SPI,MOSI: 0x70
1.387343562500000,SPI,MOSI: 0x40
1.387387375000000,SPI,MOSI: 0x4C
1.387390000000000,SPI,MOSI: 0xE2
1.387433687500000,SPI,MOSI: 0xE1
1.387477437500000,SPI,MOSI: 0x2A
1.387522500000000,SPI,MOSI: 0x11
1.387525125000000,SPI,MOSI: 0x11
1.387527750000000,SPI,MOSI: 0x11
1.387530375000000,SPI,MOSI: 0x11
1.387533000000000,SPI,MOSI: 0x11
1.387535625000000,SPI,MOSI: 0x30
1.387578875000000,SPI,MOSI: 0x11
1.387581500000000,SPI,MOSI: 0x11
1.387584125000000,SPI,MOSI: 0x11
1.387586687500000,SPI,MOSI: 0x11
1.387589312500000,SPI,MOSI: 0x11
Attachments
NRF24.fcfx
(11.15 KiB) Downloaded 295 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: UART counts double?

Post by Benj »

Hello,

The nRF24L01 component uses SPI which unlike UART is clock driven and so as long as the data is in time with the clock the actual data rate has no real effect.

However as your using hardware SPI the data rate should remain constant for the duration of your program.

You have the SPI prescaler set to Fosc /2 or 8MHz which is pretty fast, maybe try increasing the prescaler setting a bit and see if this helps.

MJU
Posts: 502
Joined: Wed Nov 07, 2007 6:51 pm
Location: Antwerp Belgium
Has thanked: 121 times
Been thanked: 108 times

Re: UART counts double?

Post by MJU »

I have tried several settings for the OSC.. but the error remains.

I have tried the "naked" flowcharts I have made for V6 (and which are the base for this V7 component I think).
And this works fine with the OSC settings..

I was wrong naming the SPI Uart in my original post..

MJU
Posts: 502
Joined: Wed Nov 07, 2007 6:51 pm
Location: Antwerp Belgium
Has thanked: 121 times
Been thanked: 108 times

Re: UART counts double?

Post by MJU »

I think I found it.

There was a problem with my logic analyser and the speed of the SPI didn't do any good.
I reduced the speed and managed to get my logic analyser working right.

Thanks

Post Reply