chipKIT® Development Platform

Inspired by Arduino™

PIC32MX270f256D serial timing issue

Created Wed, 23 Mar 2016 13:52:51 +0000 by GastonLagaffe


GastonLagaffe

Wed, 23 Mar 2016 13:52:51 +0000

Salut,

I am testing two identicaö boards with one holding the PIC32MX250F128D and the other using the PIC32MX2270F256D. Both chips work as expected until I tested serial UART1 and UART2. The PIC32MX270F256D seems to have a timing issue: Instead of "Hello World 2" I get "HPkejfdd-E_Pëev"

I run both chips with 40 MHz

Ciao, Mathias


majenko

Wed, 23 Mar 2016 15:45:41 +0000

Are you sure you have your timing right? Is F_CPU set right for your 270 board?

I just tested my 270 based Lenny with my little logic analyser and it worked perfectly at 115200 baud: [attachment=0]snap1.png[/attachment]

Same result on both UARTs. Mind, I run at 48MHz not 40MHz. Not that it should make any difference - unless you are running at 40MHz with an F_CPU of 48MHz. Or running with an F_CPU of 40MHz when your board isn't really running at 40MHz as you suppose but some other frequency...


majenko

Wed, 23 Mar 2016 15:46:55 +0000

One tip for diagnosing UARTs:

Output a constant stream of 'U' and measure the frequency of the square wave produced. Double that frequency, and that's the baud rate you are running at.


GastonLagaffe

Wed, 23 Mar 2016 17:10:04 +0000

Salut Matt,

I am totally lost now: I have created a bootloaded with 48MHz settings and loaded it into the chip I have created a board.txt file with

build.mcu=32MX270F256D
build.f_cpu=48000000L

and the compilation runs using the MX270 processor flag as well as F_CPU=48000000L but the baudrate is 9600 uplifted by 48/40 Funny enough, if I compile with fubarino-mini as board, the baud rate is correct. So it must be something in my board.txt file but I cannot spot it. Here is the file:

variant=boxtec-helvepic32SMDa
description=HelvePic32SMDa
group=Boxtec
platform=pic32
board=_BOARD_HELVEPIC32SMDA_ -G1024
board.flags=-D_USE_USB_FOR_SERIAL_::-D_USB
ccflags=-Map="map.map"
ldscript=chipKIT-application-32MX270F256${upload.${prefs:board.${prefs:board}.programmer}.ldsuffix}.ld
upload.protocol=stk500v2
upload.maximum_size=262144
upload.speed=115200
build.mcu=32MX270F256D
build.f_cpu=48000000L
build.core=pic32
build.variant=boxtec-helvepic32SMDa
family=pic32
version=0.7
revision=3
core=chipkit
name=HelvePic32SMDa

bootloader.file=${board:root}/HELVEPIC32SDM44A

Just a few simple questions: where do I determine the speed the board is running on?

Ciao, Mathias BTW: I noticed a bit late that changes to te board definitions are not read automatically and that I have to launch the plugin Manager to re-read the board definitions


majenko

Wed, 23 Mar 2016 18:02:21 +0000

There is a shortcut to reloading the definitions in the "Help -> Debug -> Rebuild internal structures" menu entry.

Also you may need to purge out the core cached files after making these kind of changes - otherwise the serial code won't be compiled with the new F_CPU setting. Hold the SHIFT key while clicking the compile button.