palWriteGroup() macro

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

Moderators: RoccoMarco, lbednarz, tfAteba

User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: palWriteGroup() macro

Post by Giovanni »

Hi,

A bus can only include contiguous pins on the same port.

palWriteGroup() and palWriteBus() are similar except that the first is a macro and the second uses that bus structure. palWritePort() simply operates on the whole port, not a subset of pins.

Giovanni
avtop
Posts: 6
Joined: Tue Sep 17, 2013 8:33 am

Re: palWriteGroup() macro

Post by avtop »

Hi giovani

Thx for replay, will pls give sample code to better understand what I want to do 16 bit data to 8bit LCD Interface

thx
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: palWriteGroup() macro

Post by Giovanni »

You should give details, your description is not sufficient to write code. You may also give a look to uGFX, they have already several LCD drivers.

Giovanni
avtop
Posts: 6
Joined: Tue Sep 17, 2013 8:33 am

Re: palWriteGroup() macro

Post by avtop »

what I Have
PB0,PB2,PB3,PB4,PB5,PB6,PB7,PB10 pin for Lower 8bit
A16,A15,A14,A12,A0,A1,A2,A4 for Higher 8bit
can I use this as bus
Thx
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: palWriteGroup() macro

Post by Giovanni »

You can't make a bus, bits are on different ports and not contiguous. You have to write your own functions in order to align the bits properly and then use palReadPort() and palWritePort() in order to implement an read-modify-write cycle.

It is very complex, setting bits one by one would be easier but not efficient. You should at least try to use contiguous pins.

Giovanni
avtop
Posts: 6
Joined: Tue Sep 17, 2013 8:33 am

Re: palWriteGroup() macro

Post by avtop »

I have MapleMini Board
What I am trying to set GPIOB.4,GPIOB.3 set as
palSetPadMode(GPIOB, 3, PAL_MODE_OUTPUT_PUSHPULL);
after all I did but always I both pins are float line INPUT this pins are JTAG pins Is that any setting in config for JTAG to use or disable or else what I do to check ,
Code is just to make high low in these pins nothing else
Thx
avtop
Posts: 6
Joined: Tue Sep 17, 2013 8:33 am

Re: palWriteGroup() macro

Post by avtop »

Hi

I am not getting control(no Output) on PB3 and PB4 Pin
and PB0,PB1,PB2, PB5 is giving response on SW Press
Code is onlt this line GPIOB,8 is Input Pin In MApleMini same code well working in MapleIDE

int main(void){
// halInit(); // initialize hardware abstraction layer
// chSysInit(); // initialize ChibiOS kernel
GPIOB->CRL = 0x88333333;
while(1){

if(palReadPad(GPIOB, 8))
{
GPIOB->BSRR = 0b00111111;
}
else
{
GPIOB->BRR = 0b00111111;
}
// chThdSleepMilliseconds(500);
}
}
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: palWriteGroup() macro

Post by Giovanni »

It is because without initialization GPIO is not clocked.

Giovanni
avtop
Posts: 6
Joined: Tue Sep 17, 2013 8:33 am

Re: palWriteGroup() macro

Post by avtop »

HI

i have tried with
#include "ch.h"
#include "hal.h"
also

but PB0,PB2,PB5,PB6 is giving response with PB1 as Input
ONLY PB3 and PB4 is opwndrain input
may GPIO clk init. by MapleMini Bootloader

I checked the GPIOB->CRL Data also its set as Output those Pin I set those pin as PUSH-PULL-OUTPUT so GPIOB-CRL is 0x88333383 return value

THX
Post Reply