[fpc-devel] Embedded Strings on nRF51-DK

Paul Michell Paul at michellcomputing.co.uk
Tue Apr 28 23:43:24 CEST 2015


Micheal,

I have started to encounter problems with the UART handling.  Test4 starts to 
add some program logic and construct debugging messages back through the UART 
functions.

The first problem is a corrupting of the system start message, although 
subsequent message output is fine?  This can be seen in the attached image.
Strangely, I have found by trial and error, that removing:

      GPIOOutputPin(TXDPinNumber);

from the UARTConfigure procedure (which is a line-for-line translation of the 
original GCC function) makes this issue go away!  I don't understand why this 
happens, nor if it is safe for me to leave out this line permanently from the 
procedure? 

Secondly, the run counter should be formatted by the string expression:

      MessageText := 'Run: '+IntToStr(RunCount)+#13#10;
      UARTSendString(MessageText);

All that is actually printed is the RunCount number.  This can also be seen in 
the screen shot.  I wonder if there is some aspect of the string handling that 
is still not being linked?  If so, would it be possible to fix this, as this 
sort of trivial text construction is a major benefit of Pascal over C.

I have also managed to get button input working and some initial success with 
using timer interrupts rather than the rather clumsy wait loops included in 
these tests.  At the moment this code still uses my old nRF51 header 
translation.  I will next work on converting these to use your header layout.  
I would be happy to post these here if anyone would like them?

After this I want to start looking at how to use the RF/Bluetooth softdevice, 
has anyone else tried this yet?

Thanks,

Paul 
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nrf51output.jpeg
Type: image/jpeg
Size: 19459 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20150428/d4e6fa7f/attachment.jpeg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test4.pas
Type: text/x-pascal
Size: 879 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20150428/d4e6fa7f/attachment.pas>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nRF51Utils.pas
Type: text/x-pascal
Size: 4683 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20150428/d4e6fa7f/attachment-0001.pas>


More information about the fpc-devel mailing list