Problems programming Xminilab Portable

More
12 years 2 months ago - 12 years 2 months ago #919 by remo
Hi!
Today I thought it would be nice to use the Xminilab portable to measure capacitors. So lets write a small hello world program and write it on the chip. We can allways go back to the original software, right? Well, doesnt look like it. I can't seem to go back into bootloader to reprogram via USB. Now I took everything apart and disconnected the battery to do some tests, but till now without any success. Can you please point me into the right direction so I can at least get into programming again?
Greetings!/\r\n/Remo
Code:
#define PinCtrlInvert 0x40
#define PinCtrlTotemPolePullDown 0x10
#define PinCtrlTotemPolePullUp 0x18
#define PinCtrlDigitalDisable 0x07

#define DacCh0Enable 0x04
#define DacEnable 0x01;
#define DacReferencePortA 0x10
#define DacDataLeftAdjust 0x01

void Configure(void)
{
// buttons
PORTA.PIN1CTRL = PinCtrlTotemPolePullUp;
PORTA.PIN2CTRL = PinCtrlTotemPolePullDown;
PORTA.PIN3CTRL = PinCtrlTotemPolePullDown;
PORTA.PIN4CTRL = PinCtrlTotemPolePullDown;
// diodes
PORTD.DIR = PIN0_bm | PIN4_bm;
// analog channels
PORTA.PIN5CTRL = PinCtrlDigitalDisable;
PORTA.PIN6CTRL = PinCtrlDigitalDisable;
PORTA.PIN7CTRL = PinCtrlDigitalDisable;
// battery
PORTE.DIR = PIN0_bm;
// dac
DACB.CTRLC = DacReferencePortA;
DACB.CTRLA = DacCh0Enable | DacEnable;
}

inline void PowerOn(void)
{
PORTE.OUTSET = PIN0_bm;
}

inline void PowerOff(void)
{
PORTE.OUTCLR = PIN0_bm;
}

inline void LedGreenOn(void)
{
PORTD.OUTSET = PIN4_bm;
}

inline void LedGreenOff(void)
{
PORTD.OUTCLR = PIN4_bm;
}

inline void LedRedOn(void)
{
PORTD.OUTSET = PIN0_bm;
}

inline void LedRedOff(void)
{
PORTD.OUTCLR = PIN0_bm;
}

inline void DacSetHigh(void)
{
DACB.CH0DATA = 4095;
}

inline void DacSetLow(void)
{
DACB.CH0DATA = 0;
}

int main(void)
{
int i;
Configure();
PowerOn();
for(i = 0; i < 5; i++)
{
LedGreenOn();
LedRedOff();
_delay_ms(500);
LedRedOn();
LedGreenOff();
_delay_ms(500);
}
PowerOff();
}
Last edit: 12 years 2 months ago by remo.

Please Log in or Create an account to join the conversation.

More
12 years 2 months ago - 12 years 2 months ago #920 by remo
deleted the post... probably was confused here.
Greetings!/\r\n/Remo
Last edit: 12 years 2 months ago by remo.

Please Log in or Create an account to join the conversation.

More
12 years 2 months ago - 12 years 2 months ago #921 by remo
Hi again!
I managed to get back into bootloader and reload the original hex-files. I still have the display bug as you described some time ago, but happy programming can now continue :). I think I didn't keep K4 pressed long enough.
Maybe you still got some comments on the code I posted and also the stuff I posted on github regarding QT-UI. I could send you the modified UI-File if you are interested. Its a bit frustrating to get no answer at all.
There is another thing you might want to have a look at in main.h on line 210 of the firmware. The array addr_ack is defined with a length of 257 bytes, which makes I2C 1281 bytes long. Thats one byte longer than the other two types in the union and might cause some unexpected behaviour.
Greetings!/\r\n/Remo
Last edit: 12 years 2 months ago by remo.

Please Log in or Create an account to join the conversation.

Time to create page: 0.082 seconds
Powered by Kunena Forum