PAL-Driver Problem with groupmode

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
THaala
Posts: 12
Joined: Tue Dec 06, 2011 10:27 pm

PAL-Driver Problem with groupmode

Post by THaala »

Dear Giovanni,

i seems i found a little problem here:

I tried to use the Group - Mode of GPIO with GPIOV2. I need to Group the Bits 8 - 15 of GPIOE.

I interpret the following define as information how to use the members "mask" and "offset".

Code: Select all

#define pal_lld_writegroup(port, mask, offset, bits)   \  
  ((port)->BSRR.W = ((~(bits) & (mask)) << (16 + (offset))) | (((bits) & (mask)) << (offset)))

this define is feeded with the call of palWriteBus (&LCD_Bus, 0x5A);
The idea was to shift the Bits 0-7 to the bits 8 - 15. (if using the BusIO descriptor LCD_Bus i got what i need!)

Problem:
Whithin initialization the BusIO - Member "offset" is not evaluated. if i use a BusIO

Code: Select all

{ 
   GPIOE,
   0xFF,
   8
}

The function pal_lld_writegroup writes to the correct bits 8 - 15 but the Init do the wrong IO's (0 -7).
A current workaround is to use different descriptors for init and for manipulating output:

Code: Select all

static BusIO LCD_Bus;
static BusIO LCDInit_Bus;

   LCD_Bus.portid = GPIOE;
   LCD_Bus.mask = 0xFF;
   LCD_Bus.offset = 8;

   LCDInit_Bus.portid = GPIOE;
   LCDInit_Bus.mask = 0xFF00;
   LCDInit_Bus.offset = 0 /* don't care */ ;

i think the best way was to evaluate the member "offset" also in _pal_lld_setgroupmode() while initialization. I use the trunk 2.3.6
What do you think about it ?
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: PAL-Driver Problem with groupmode

Post by Giovanni »

Hi,

I fixed it into the pal_lld_setgroupmode() macro in order to not impact all the implementations. Please let me know if it is OK now.

Giovanni
THaala
Posts: 12
Joined: Tue Dec 06, 2011 10:27 pm

Re: PAL-Driver Problem with groupmode

Post by THaala »

Hello Giovanni,

thank you for your fast help.
The fix is working well.

Have a good new Year.
T.
Post Reply