chipKIT® Development Platform

Inspired by Arduino™

chipKIT-core v1.4.3 released

Created Sat, 29 Jul 2017 13:00:35 +0000 by EmbeddedMan


EmbeddedMan

Sat, 29 Jul 2017 13:00:35 +0000

A very minor release:

[url]https://github.com/chipKIT32/chipKIT-core/releases[/url]

And release notes:

[url]http://chipkit.net/wiki/index.php?title=ChipKIT_core_release_notes[/url]

Only change was core changes to support running Flip-N-Click MZ board at 252 MHz (was 200 MHz)

Enjoy!


bliviudaniel

Tue, 28 Nov 2017 09:39:13 +0000

Hello,

I implemented an ADC driver for Chipkit Uno32 and I used the structure p32_adc from p32_defs.h file. The definition of the structure is not good because it does not respect the order and the addresses of the registers. Here is how it's defined now:

typedef struct {
    volatile p32_regset adxCon1;
    volatile p32_regset adxCon2;
    volatile p32_regset adxCon3;
    volatile p32_regset adxChs;
    volatile p32_regset adxPcfg;
    volatile p32_regset adxCssl;
    volatile p32_regbuf adxBuf0;
    volatile p32_regbuf adxBuf1;
    volatile p32_regbuf adxBuf2;
    volatile p32_regbuf adxBuf3;
    volatile p32_regbuf adxBuf4;
    volatile p32_regbuf adxBuf5;
    volatile p32_regbuf adxBuf6;
    volatile p32_regbuf adxBuf7;
    volatile p32_regbuf adxBuf8;
    volatile p32_regbuf adxBuf9;
    volatile p32_regbuf adxBufA;
    volatile p32_regbuf adxBufB;
    volatile p32_regbuf adxBufC;
    volatile p32_regbuf adxBufD;
    volatile p32_regbuf adxBufE;
    volatile p32_regbuf adxBufF;
} p32_adc;

With this definition the ADC driver does not work because AD1PCFG is never written. Between adxCon3 and adxChs it should be an empty field as the address 0xBF809030 is not used by ADC (according to datasheet). Also, adxCssl is at address 0xBF809050 and must be before adxPcfg which is at address 0xBF809060. I made the described modifications, based on the correct order of the registers in memory:

typedef struct {
    volatile p32_regset adxCon1;
    volatile p32_regset adxCon2;
    volatile p32_regset adxCon3;
    volatile p32_regset unused;
    volatile p32_regset adxChs;
    volatile p32_regset adxCssl;
    volatile p32_regset adxPcfg;
    volatile p32_regbuf adxBuf0;
    volatile p32_regbuf adxBuf1;
    volatile p32_regbuf adxBuf2;
    volatile p32_regbuf adxBuf3;
    volatile p32_regbuf adxBuf4;
    volatile p32_regbuf adxBuf5;
    volatile p32_regbuf adxBuf6;
    volatile p32_regbuf adxBuf7;
    volatile p32_regbuf adxBuf8;
    volatile p32_regbuf adxBuf9;
    volatile p32_regbuf adxBufA;
    volatile p32_regbuf adxBufB;
    volatile p32_regbuf adxBufC;
    volatile p32_regbuf adxBufD;
    volatile p32_regbuf adxBufE;
    volatile p32_regbuf adxBufF;
} p32_adc;

and now, my ADC driver is working well.

Maybe this correction of p32_defs.h should be implemented in the next release of Chikit core...


majenko

Tue, 28 Nov 2017 10:37:22 +0000

Yes, that looks like an error to me. For some bizarre reason the datasheet can't count. It goes 0x...10 0x....20 0x....30 0x....60 0x.....50..... bah!

So yes, they should be swapped over and the gap plugged. The reason this hasn't been noticed is that we don't actively use that structure in the core. It was, along with many others, created in the dim and distant past in order to help abstract stuff, and never actually got used. So in all that time you're the first to spot the error.

I'll add it to the next release.


EmbeddedMan

Tue, 28 Nov 2017 13:35:46 +0000

Thanks for spotting this guys. Majenko, you added the fix to your USB branch. Did you mean to do that vs. a separate pull request?

*Brian


majenko

Tue, 28 Nov 2017 15:40:49 +0000

Yeah, that was intentional. Little fixes like this I just throw in. They are of little or no consequence since they aren't actually used by anything (as far as I can tell), and if they were we'd know about it already ;)

I'm hoping we can get this bad boy merged soon anyway, so we can get it out and in the wild for Christmas.


EmbeddedMan

Tue, 28 Nov 2017 17:38:46 +0000

Agreed. -